From a9378df15b5d23e6f31abf05f63ff3e30837aef3 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Wed, 4 Nov 2009 17:24:01 +0000
Subject: [PATCH] =?UTF-8?q?r=C3=A9cup=C3=A9ration=20des=20donn=C3=A9es?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 core/trunk/core/class/class_core_tools.php    | 1739 +++++++++++++++++
 core/trunk/core/class/class_db.php            |  614 ++++++
 core/trunk/core/class/class_docserver.php     |  317 +++
 core/trunk/core/class/class_functions.php     | 1328 +++++++++++++
 core/trunk/core/class/class_history.php       |   98 +
 core/trunk/core/class/class_manage_status.php |   98 +
 core/trunk/core/class/class_portal.php        |   83 +
 core/trunk/core/class/class_request.php       |  386 ++++
 core/trunk/core/class/class_resource.php      |  352 ++++
 core/trunk/core/class/class_security.php      | 1283 ++++++++++++
 core/trunk/core/manage_action.php             |  283 +++
 core/trunk/core/sql/data/core.mysql.sql       |    0
 core/trunk/core/sql/data/core.oracle.sql      |  176 ++
 core/trunk/core/sql/data/core.postgresql.sql  |    0
 core/trunk/core/sql/structure/core.mssql.sql  |  Bin 0 -> 103854 bytes
 core/trunk/core/sql/structure/core.mysql.sql  |  222 +++
 core/trunk/core/sql/structure/core.oracle.sql |  321 +++
 .../core/sql/structure/core.postgresql.sql    |  311 +++
 core/trunk/core/xml/actions_pages.xml         |   52 +
 core/trunk/core/xml/config.xml.default        |   33 +
 core/trunk/favicon.ico                        |  Bin 0 -> 1082 bytes
 core/trunk/index.php                          |   78 +
 core/trunk/portal/css/style_ie.css            |  116 ++
 core/trunk/portal/css/style_ie7.css           |   94 +
 core/trunk/portal/css/styles.css              |  270 +++
 core/trunk/portal/en.php                      |   17 +
 core/trunk/portal/fr.php                      |   17 +
 core/trunk/portal/img/bg_home.gif             |  Bin 0 -> 15465 bytes
 core/trunk/portal/img/logo.gif                |  Bin 0 -> 6415 bytes
 core/trunk/portal/launch_maarch.php           |   24 +
 30 files changed, 8312 insertions(+)
 create mode 100644 core/trunk/core/class/class_core_tools.php
 create mode 100644 core/trunk/core/class/class_db.php
 create mode 100644 core/trunk/core/class/class_docserver.php
 create mode 100644 core/trunk/core/class/class_functions.php
 create mode 100644 core/trunk/core/class/class_history.php
 create mode 100644 core/trunk/core/class/class_manage_status.php
 create mode 100644 core/trunk/core/class/class_portal.php
 create mode 100644 core/trunk/core/class/class_request.php
 create mode 100644 core/trunk/core/class/class_resource.php
 create mode 100644 core/trunk/core/class/class_security.php
 create mode 100644 core/trunk/core/manage_action.php
 create mode 100644 core/trunk/core/sql/data/core.mysql.sql
 create mode 100644 core/trunk/core/sql/data/core.oracle.sql
 create mode 100644 core/trunk/core/sql/data/core.postgresql.sql
 create mode 100644 core/trunk/core/sql/structure/core.mssql.sql
 create mode 100644 core/trunk/core/sql/structure/core.mysql.sql
 create mode 100644 core/trunk/core/sql/structure/core.oracle.sql
 create mode 100644 core/trunk/core/sql/structure/core.postgresql.sql
 create mode 100644 core/trunk/core/xml/actions_pages.xml
 create mode 100644 core/trunk/core/xml/config.xml.default
 create mode 100644 core/trunk/favicon.ico
 create mode 100644 core/trunk/index.php
 create mode 100644 core/trunk/portal/css/style_ie.css
 create mode 100644 core/trunk/portal/css/style_ie7.css
 create mode 100644 core/trunk/portal/css/styles.css
 create mode 100644 core/trunk/portal/en.php
 create mode 100644 core/trunk/portal/fr.php
 create mode 100644 core/trunk/portal/img/bg_home.gif
 create mode 100644 core/trunk/portal/img/logo.gif
 create mode 100644 core/trunk/portal/launch_maarch.php

diff --git a/core/trunk/core/class/class_core_tools.php b/core/trunk/core/class/class_core_tools.php
new file mode 100644
index 00000000000..de28b1f24e6
--- /dev/null
+++ b/core/trunk/core/class/class_core_tools.php
@@ -0,0 +1,1739 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @defgroup core Framework core
+*/
+
+/**
+* @brief   Contains all the functions to load core and modules
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @author  Laurent Giovannoni  <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the functions to load core and modules
+*
+* <ul>
+* <li>Loads core tables into session</li>
+* <li>Loads modules settings into session</li>
+* <li>Builds the application menu</li>
+*  <li>Management and building the framework</li>
+*  <li>Modules services loading</li>
+*  <li>Execution of the module services </li>
+*</ul>
+*
+* @ingroup core
+*/
+class core_tools extends functions
+{
+
+	/**
+	* Load Maarch core configuration into sessions vars from the core/xml/config.xml file
+	*/
+	public function build_core_config($pathtoxmlcore)
+	{
+		$xmlconfig = simplexml_load_file($pathtoxmlcore);
+
+		// Loads  core tables into session ($_SESSION['tablename'] array)
+		$TABLENAME = $xmlconfig->TABLENAME ;
+		$_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']['ext_docserver'] = (string) $TABLENAME->extdocserver;
+		$_SESSION['tablename']['fulltext'] = (string) $TABLENAME->fulltext;
+		$_SESSION['tablename']['groupsecurity'] = (string) $TABLENAME->groupsecurity;
+		$_SESSION['tablename']['history'] = (string) $TABLENAME->history;
+		$_SESSION['tablename']['history_batch'] = (string) $TABLENAME->history_batch;
+		$_SESSION['tablename']['param'] = (string) $TABLENAME->param;
+		$_SESSION['tablename']['resgroups'] = (string) $TABLENAME->resgroups;
+		$_SESSION['tablename']['resgroup_content'] = (string) $TABLENAME->resgroup_content;
+		$_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;
+	}
+
+	/**
+	* Load Maarch modules configuration into sessions vars from modules/module_name/xml/config.xml files
+	*
+	* @param $modules array  Enabled modules of the application
+	*/
+	public function load_modules_config($modules, $mode_batch=false)
+	{
+		// Browses enabled modules
+		for($i=0;$i<count($modules);$i++)
+		{
+			$path_config = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml";
+			$path_lang = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php';
+			// Reads the config.xml file of the current module
+			$xmlconfig = simplexml_load_file($path_config);
+			// Loads into $_SESSION['modules_loaded'] module's informations
+			foreach($xmlconfig->CONFIG as $CONFIG)
+			{
+				$tmp = (string) $CONFIG->name;
+				$tmp2 = $this->retrieve_constant_lang($tmp, $path_lang);
+				if($tmp2 <> false)
+				{
+					$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['name'] = $tmp2;
+				}
+				else
+				{
+					$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['name'] = $tmp;
+				}
+				$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['path'] = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR;
+				$tmp = (string) $CONFIG->comment;
+				$tmp2 = $this->retrieve_constant_lang($tmp, $path_lang);
+				if($tmp2 <> false)
+				{
+					$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['comment'] = $tmp2;
+				}
+				else
+				{
+					$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['comment'] = $tmp;
+				}
+				$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['fileprefix'] = (string) $CONFIG->fileprefix;
+				$_SESSION['modules_loaded'][$modules[$i]['moduleid']]['loaded'] = (string) $CONFIG->loaded;
+			}
+			$path_module_tools = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php";
+			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
+			foreach($xmlconfig->KEYWORDS as $keyword)
+			{
+				$tmp = (string) $keyword->label;
+				$tmp2 = $this->retrieve_constant_lang($tmp, $path_lang);
+				if($tmp2 <> false)
+				{
+					$tmp = $tmp2;
+				}
+				$id = (string) $keyword->id;
+				if(!$this->is_var_in_history_keywords_tab($id))
+				{
+					array_push($_SESSION['history_keywords'], array('id' =>$id,'label' =>$tmp));
+				}
+			}
+		}
+		if(!$mode_batch)
+		{
+			//Loads logs keywords of the actions
+			require_once($_SESSION['pathtocoreclass']."class_db.php");
+			$db = new dbquery();
+			$db->connect();
+			$db->query("select id, label_action from ".$_SESSION['tablename']['actions']." where enabled = 'Y' and history = 'Y'");
+			while($res = $db->fetch_object())
+			{
+				array_push($_SESSION['history_keywords'], array('id' =>'ACTION#'.$res->id,'label' => $this->show_string($res->label_action)));
+			}
+		}
+	}
+
+	/**
+	* Check if the log keyword is known in the apps
+	*
+	* @param $id  string Log keyword to check
+	* @return bool True if the keyword is found, False otherwise
+	*/
+	public function is_var_in_history_keywords_tab($id)
+	{
+		$found = false;
+		for($i=0;$i<count($_SESSION['history_keywords']);$i++)
+		{
+			if($_SESSION['history_keywords'][$i]['id'] == $id)
+			{
+				$found = $_SESSION['history_keywords'][$i]['label'];
+				break;
+			}
+		}
+		return $found;
+	}
+
+	/**
+	* Loads the modules specific vars into session
+	*
+	* @param $modules Enabled modules of the application
+	*/
+	public function load_var_session($modules)
+	{
+		for($i=0;$i<count($modules);$i++)
+		{
+			$path_module_tools = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php";
+			require_once($path_module_tools);
+			$modules_tools = new $modules[$i]['moduleid'];
+			$modules_tools->load_module_var_session();
+		}
+	}
+
+	/**
+	* Loads language variables into session
+	*/
+	public function load_lang()
+	{
+		if(file_exists($_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'))
+		{
+			include($_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+		}
+		else
+		{
+			$_SESSION['error'] = "Language file missing...<br/>";
+		}
+		$this->load_lang_modules($_SESSION['modules']);
+	}
+
+	/**
+	* Loads language variables of each module
+	*
+	* @param  $modules array Enabled modules of the application
+	*/
+	private function load_lang_modules($modules)
+	{
+		for($i=0;$i<count($modules);$i++)
+		{
+			$path_lang_module = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php';
+			if(file_exists($path_lang_module))
+			{
+				include($path_lang_module);
+			}
+			else
+			{
+				$_SESSION['error'] .= "Language file missing for module : ".$modules[$i]['moduleid']."<br/>";
+			}
+		}
+	}
+
+	/**
+	* Loads menu items of each module and the application into session from menu.xml files
+	*
+	* @param $modules array Enabled modules of the application
+	*/
+	public function load_menu($modules)
+	{
+		// Browses the enabled modules array
+		$k=0;
+		for($i=0;$i<count($modules);$i++)
+		{
+			$path_menu = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."menu.xml";
+			// Reads the module/module_name/xml/menu.xml file  and loads into session
+			$path_lang = $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php';
+			$xmlconfig = simplexml_load_file($path_menu);
+			foreach($xmlconfig->MENU as $MENU)
+			{
+				$_SESSION['menu'][$k]['id'] = (string) $MENU->id;
+				if($_SESSION['user']['services'][$_SESSION['menu'][$k]['id'] ] == true)
+				{
+					$tmp = (string) $MENU->libconst;
+					$tmp2 = $this->retrieve_constant_lang($tmp, $path_lang);
+					if($tmp2 <> false)
+					{
+						$_SESSION['menu'][$k]['libconst'] = $tmp2;
+					}
+					else
+					{
+						$_SESSION['menu'][$k]['libconst'] = $tmp;
+					}
+					$_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++;
+			}
+		}
+
+		// Reads the apps/apps_name/xml/menu.xml file  and loads into session
+		$xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath'].'xml'.DIRECTORY_SEPARATOR.'menu.xml');
+		$path_lang =$_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php';
+		foreach($xmlconfig->MENU as $MENU2)
+		{
+			$_SESSION['menu'][$k]['id'] = (string) $MENU2->id;
+			if($_SESSION['user']['services'][$_SESSION['menu'][$k]['id']] == true)  // Menu Identifier must be equal to the Service identifier
+			{
+				$tmp = (string) $MENU2->libconst;
+				$tmp2 = $this->retrieve_constant_lang($tmp, $path_lang);
+				if($tmp2 <> false)
+				{
+					$_SESSION['menu'][$k]['libconst'] = $tmp2;
+				}
+				else
+				{
+					$_SESSION['menu'][$k]['libconst'] = $tmp;
+				}
+				$_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) $MENU->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++;
+		}
+	}
+
+	/**
+	* Builds the application menu from the session var menu
+	*
+	* @param  $menu array Enabled menu items
+	*/
+	public function build_menu($menu)
+	{
+		// Browses the menu items
+		for($i=0;$i<count($menu);$i++)
+		{
+			if($menu[$i]['show'] == true)
+			{
+				$tmp = preg_replace('/&module/', '&amp;module', $menu[$i]['url']);
+				if(preg_match('/php$/', $tmp))
+				{
+					$tmp .= "?reinit=true";
+				}
+				else
+				{
+					$tmp .= "&amp;reinit=true";
+				}
+				?>
+				<li id="<?php  echo $menu[$i]['style'];?>" onmouseover="this.className='on';" onmouseout="this.className='';"><a href="#" onclick="window.open('<?php  echo $tmp;?>', '<?php  if($menu[$i]['target'] <> ''){echo $menu[$i]['target'];}else{echo '_self';}?>');"><span><span><?php  echo trim($menu[$i]['libconst']);?></span></span></a></li>
+				<?php
+			}
+		}
+
+		// Menu items always displayed
+		echo '<li id="account" onmouseover="this.className=\'on\';" onmouseout="this.className=\'\';">
+		<a href="'.$_SESSION['config']['businessappurl'].'index.php?page=modify_user&admin=users&reinit=true"><span><span>'._MY_INFO.'</span></span></a></li>';
+		echo '<li id="logout" onmouseover="this.className=\'on\';" onmouseout="this.className=\'\';">
+		<a href="'.$_SESSION['config']['businessappurl'].'logout.php?coreurl='.$_SESSION['config']['coreurl'].'"><span><span>'._LOGOUT.'</span></span></a></li>';
+	}
+
+	/**
+	* Loads application services into session
+	*/
+	public function load_app_services()
+	{
+		// Reads the application config.xml file
+		$xmlconfig = simplexml_load_file($_SESSION['config']['businessapppath']."xml".DIRECTORY_SEPARATOR."services.xml");
+		$k = 0;
+		$m = 0;
+		// Browses the services in that file  and loads $_SESSION['app_services']
+		foreach($xmlconfig->SERVICE as $SERVICE)
+		{
+			$_SESSION['app_services'][$k]['id'] = (string) $SERVICE->id;
+			$tmp = (string) $SERVICE->name;
+			$tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+			if($tmp2 <> false)
+			{
+				$_SESSION['app_services'][$k]['name'] = $tmp2;
+			}
+			else
+			{
+				$_SESSION['app_services'][$k]['name'] = $tmp;
+			}
+
+			$tmp = (string) $SERVICE->comment;
+			$tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+			if($tmp2 <> false)
+			{
+				$_SESSION['app_services'][$k]['comment'] = $tmp2;
+			}
+			else
+			{
+				$_SESSION['app_services'][$k]['comment'] = $tmp;
+			}
+			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;
+			}
+
+			$system_service =  (string) $SERVICE->system_service;
+			if($system_service == "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)
+			{
+				$_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))
+				{
+					$_SESSION['app_services'][$k]['whereamiused'][$l]['tab_label'] = $this->retrieve_constant_lang((string) $WHEREAMIUSED->tab_label, $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+
+				}
+				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->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->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 $modules array Enabled modules of the application
+	*/
+	public function load_modules_services($modules)
+	{
+		// Browses the enabled modules array
+		for($i=0;$i<count($modules);$i++)
+		{
+			// Reads the module config.xml file
+			$xmlconfig = simplexml_load_file($_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."services.xml");
+			$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;
+					$tmp = (string) $SERVICE->name;
+					$tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+					if($tmp2<> false)
+					{
+						$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['name']=$tmp2;
+					}
+					else
+					{
+						$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['name']=$tmp;
+					}
+					$tmp = (string) $SERVICE->comment;
+					$tmp2 = $this->retrieve_constant_lang($tmp, $_SESSION['pathtomodules'].$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php');
+					if($tmp2<> false)
+					{
+						$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['comment']=$tmp2;
+					}
+					else
+					{
+						$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['comment']=$tmp;
+					}
+					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;
+					}
+					$system_service =  (string) $SERVICE->system_service;
+					if($system_service == "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))
+						{
+							$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['button_label'] = $this->retrieve_constant_lang((string) $WHEREAMIUSED->button_label, $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+						}
+						if(isset($WHEREAMIUSED->tab_label))
+						{
+							$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_label'] = $this->retrieve_constant_lang((string) $WHEREAMIUSED->tab_label, $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+						}
+						if(isset($WHEREAMIUSED->tab_order))
+						{
+							$_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_order'] = (string) $WHEREAMIUSED->tab_order;
+						}
+						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->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++;
+				}
+			}
+		}
+	}
+
+	/**
+	* Executes the module' s services in the page
+	*
+	* @param $modules_services  array List of the module's services
+	* @param $whereami  string Page where to execute the service
+	* @param $servicenature string  Nature of the service (by default, the function takes all the services natures)
+	* @param  $id_service string Identifier of one specific service (empty by default)
+	* @param  $id_module string Identifier of one specific module (empty by default)
+	*/
+	public function execute_modules_services($modules_services, $whereami, $servicenature = "all", $id_service = '', $id_module = '')
+	{
+		$executed_services = array();
+		if(!empty($id_service) && !empty($id_module))
+		{
+			for($i=0;$i < count($modules_services[$id_module]);$i++)
+			{
+				if($modules_services[$id_module][$i]['id'] == $id_service)
+				{
+					for($k=0; $k < count($modules_services[$id_module][$i]['whereamiused']);$k++)
+					{
+				 		if($modules_services[$id_module][$i]['whereamiused'][$k]['page'] == $whereami)
+						{
+							if($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == "frame" && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']] && !in_array($modules_services[$id_module][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$id_module][$i]['id']);
+								?>
+								<br />
+								<iframe src='<?php  echo $_SESSION['urltomodules'].$id_module."/".$modules_services[$id_module][$i]['servicepage'];?>' name="<?php  echo $modules_services[$id_module][$i]['id'];?>" id="<?php  echo $modules_services[$id_module][$i]['id'];?>" width='<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['width'];?>' height='<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['height'];?>' frameborder='<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['border'];?>' scrolling='<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['scrolling'];?>'></iframe><br /><br />
+								<?php
+								break;
+							}
+							elseif($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == "popup" && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']] && !in_array($modules_services[$id_module][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$id_module][$i]['id']);
+								echo $modules_services[$id_module][$i]['name'];
+								?>
+								<br />
+								<a href='<?php  echo $_SESSION['urltomodules'].$id_module."/".$modules_services[$id_module][$i]['servicepage'];?>' target='_blank'><?php  echo _ACCESS_TO_SERVICE;?></a><br /><br />
+								<?php
+								break;
+							}
+							elseif($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == "button" && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']] && !in_array($modules_services[$id_module][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$id_module][$i]['id']);
+								$tmp = $modules_services[$id_module][$i]['whereamiused'][$k]['button_label'];
+								$tmp2 = $this->retrieve_constant_lang($modules_services[$id_module][$i]['whereamiused'][$k]['button_label'], $_SESSION['modules_loaded'][$id_module]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+								if($tmp2 <> false)
+								{
+									$tmp = $tmp2;
+								}
+								?>
+								<input type="button" name="<?php  echo $modules_services[$id_module][$i]['id'];?>" value="<?php  echo $tmp;?>" onclick="window.open('<?php  echo $_SESSION['urltomodules'].$id_module.'/'.$modules_services[$id_module][$i]['servicepage'];?>', '<?php  echo $modules_services[$id_module][$i]['id'];?>','width=<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['width'];?>,height=<?php  echo $modules_services[$id_module][$i]['whereamiused'][$k]['height'];?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
+								<?php
+								break;
+							}
+							elseif($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == "include" && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']] && !in_array($modules_services[$id_module][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$id_module][$i]['id']);
+								include($_SESSION['pathtomodules'].$id_module.DIRECTORY_SEPARATOR.$modules_services[$id_module][$i]['servicepage']);
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			$tab_view = array();
+			foreach(array_keys($modules_services) as $value)
+			{
+				for($i=0;$i<count($modules_services[$value]);$i++)
+				{
+					for($k=0;$k<count($modules_services[$value][$i]['whereamiused']);$k++)
+					{
+						if($modules_services[$value][$i]['whereamiused'][$k]['page'] == $whereami  )
+						{
+							if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "frame" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']] && ($servicenature == "all" || $servicenature == "frame") && !in_array($modules_services[$value][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$value][$i]['id']);
+								?>
+								<br />
+								<iframe src='<?php  echo $_SESSION['urltomodules'].$value."/".$modules_services[$value][$i]['servicepage'];?>' name="<?php  echo $modules_services[$value][$i]['id'];?>" id="<?php  echo $modules_services[$value][$i]['id'];?>" width='<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['width'];?>' height='<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['height'];?>' frameborder='<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['border'];?>' scrolling='<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['scrolling'];?>'></iframe><br /><br />
+								<?php
+							}
+							elseif($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "tab" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']] && ($servicenature == "tab") && !in_array($modules_services[$value][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$value][$i]['id']);
+								$tab_label = $modules_services[$value][$i]['whereamiused'][$k]['tab_label'];
+								$tab_order = $modules_services[$value][$i]['whereamiused'][$k]['tab_order'];
+								$frame_src = $_SESSION['urltomodules'].$value."/".$modules_services[$value][$i]['servicepage'];
+								$tab_view[$tab_order]['tab_label'] = $this->retrieve_constant_lang($tab_label, $_SESSION['modules_loaded'][$value]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+								$tab_view[$tab_order]['frame_src'] = $frame_src;
+							}
+							elseif($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "popup" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']] && ($servicenature == "all" || $servicenature == "popup") && !in_array($modules_services[$value][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$value][$i]['id']);
+								echo $modules_services[$value][$i]['name'];
+								?>
+								<br />
+								<a href='<?php  echo $_SESSION['urltomodules'].$value."/".$modules_services[$value][$i]['servicepage'];?>' target='_blank'><?php  echo _ACCESS_TO_SERVICE;?></a><br /><br />
+								<?php
+							}
+							elseif($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "button" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']]&& ($servicenature == "all" || $servicenature == "button") && !in_array($modules_services[$value][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$value][$i]['id']);
+								$tmp = $modules_services[$value][$i]['whereamiused'][$k]['button_label'];
+								$tmp2 = $this->retrieve_constant_lang($modules_services[$value][$i]['whereamiused'][$k]['button_label'], $_SESSION['modules_loaded'][$value]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+								if($tmp2 <> false)
+								{
+									$tmp = $tmp2;
+								}
+								?>
+								<input type="button" name="<?php  echo $modules_services[$value][$i]['id'];?>" value="<?php  echo $tmp;?>" onclick="window.open('<?php  echo $_SESSION['urltomodules'].$value.'/'.$modules_services[$value][$i]['servicepage'];?>', '<?php  echo $modules_services[$value][$i]['id'];?>','width=<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['width'];?>,height=<?php  echo $modules_services[$value][$i]['whereamiused'][$k]['height'];?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
+								<?php
+							}
+							elseif($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "include" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']] && ($servicenature == "all" || $servicenature == "include") && !in_array($modules_services[$value][$i]['id'], $executed_services))
+							{
+								array_push($executed_services,$modules_services[$value][$i]['id']);
+								include($_SESSION['pathtomodules'].$value.DIRECTORY_SEPARATOR.$modules_services[$value][$i]['servicepage']);
+							}
+						}
+					}
+				}
+					//print_r($executed_services);
+			}
+		//	$this->show_array($executed_services);
+			if($servicenature == "tab")
+			{
+				//print_r($tab_view);
+				for($u=1;$u<=count($tab_view);$u++)
+				{
+					if($u == 1)
+					{
+						?>
+                        <td  class="indexingtab">
+                            <a href="javascript://" onclick="opentab('myframe', '<?php  echo $tab_view[$u]['frame_src'];?>');">
+								<?php  echo $tab_view[$u]['tab_label'];?>
+                            </a>
+                            <?php
+							$_SESSION['first_tab_to_open'] = $tab_view[$u]['frame_src'];
+							?>
+                        </td>
+						<?php
+					}
+					else
+					{
+						?>
+                        <td  class="indexingtab">
+                            <a href="javascript://" onclick="opentab('myframe', '<?php  echo $tab_view[$u]['frame_src'];?>');">
+								<?php  echo $tab_view[$u]['tab_label'];?>
+                            </a>
+                        </td>
+						<?php
+					}
+				}
+			}
+		}
+	//	$this->show_array($executed_services);
+	}
+
+
+	/**
+	* Loads the services of 'tab' nature in the page
+	*
+	* @param  $modules_services array  List of the modules services
+	* @param  $whereami string Page where to execute the service
+	*/
+	public function load_first_tab($modules_services, $whereami)
+	{
+		foreach(array_keys($modules_services) as $value)
+		{
+			for($i=0;$i<count($modules_services[$value]);$i++)
+			{
+				for($k=0;$k<count($modules_services[$value][$i]['whereamiused']);$k++)
+				{
+					if($modules_services[$value][$i]['whereamiused'][$k]['page'] == $whereami  )
+					{
+						if($modules_services[$value][$i]['whereamiused'][$k]['nature'] == "tab" && $_SESSION['user']['services'][$modules_services[$value][$i]['id']])
+						{
+							$tab_label = $modules_services[$value][$i]['whereamiused'][$k]['tab_label'];
+							$tab_order = $modules_services[$value][$i]['whereamiused'][$k]['tab_order'];
+							$frame_src = $_SESSION['urltomodules'].$value."/".$modules_services[$value][$i]['servicepage'];
+							$tab_view[$tab_order]['tab_label'] = $this->retrieve_constant_lang($tab_label, $_SESSION['modules_loaded'][$value]['path'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+							$tab_view[$tab_order]['frame_src'] = $frame_src;
+						}
+					}
+				}
+			}
+		}
+		for($u=1;$u<=count($tab_view);$u++)
+		{
+			if($u == 1)
+			{
+				$_SESSION['first_tab_to_open'] = $tab_view[$u]['frame_src'];
+			}
+		}
+	}
+
+	/**
+	* Executes the apps services in the page
+	*
+	* @param  $apps_services array  List of the application services
+	* @param  $whereami string Page where to execute the service
+	* @param  $servicenature string Nature of the service (by default, the function takes all the services natures)
+	*/
+	public function execute_app_services($app_services, $whereami, $servicenature = "all")
+	{
+		$executed_services = array();
+		for($i=0;$i<count($app_services);$i++)
+		{
+			for($k=0;$k<count($app_services[$i]['whereamiused']);$k++)
+			{
+				if($app_services[$i]['whereamiused'][$k]['page'] == $whereami  )
+				{
+					if($app_services[$i]['whereamiused'][$k]['nature'] == "frame" && $_SESSION['user']['services'][$app_services[$i]['id']] && ($servicenature == "all" || $servicenature == "frame") && !in_array($app_services[$i]['id'],$executed_services ))
+					{
+						array_push($executed_services,$app_services[$i]['id']);
+						?>
+                           <iframe src='<?php  echo $_SESSION['config']['businessappurl'].$app_services[$i]['servicepage'];?>' name="<?php  $app_services[$i]['id'];?>" id="<?php  $app_services[$i]['id'];?>" width='<?php  echo $app_services[$i]['whereamiused'][$k]['width'];?>' height='<?php  echo $app_services[$i]['whereamiused'][$k]['height'];?>' frameborder='<?php  echo $app_services[$i]['whereamiused'][$k]['border'];?>' scrolling='<?php  echo $app_services[$i]['whereamiused'][$k]['scrolling'];?>'></iframe>
+                           <?php
+					}
+					elseif($app_services[$i]['whereamiused'][$k]['nature'] == "popup" && $_SESSION['user']['services'][$app_services[$i]['id']] && ($servicenature == "all" || $servicenature == "popup") && !in_array($app_services[$i]['id'],$executed_services))
+					{
+						array_push($executed_services,$app_services[$i]['id']);
+						echo $app_services[$i]['name'];
+						?>
+                        <br />
+                        <a href='<?php  echo $_SESSION['config']['businessappservices'].$app_services[$i]['servicepage'];?>' target='_blank'><?php  echo _ACCESS_TO_SERVICE;?></a><br /><br />
+                         <?php
+					}
+					elseif($app_services[$i]['whereamiused'][$k]['nature'] == "button" && $_SESSION['user']['services'][$app_services[$i]['id']]&& ($servicenature == "all" || $servicenature == "button") && !in_array($app_services[$i]['id'],$executed_services ))
+					{
+						array_push($executed_services,$app_services[$i]['id']);
+						$tmp = $app_services[$i]['whereamiused'][$k]['button_label'];
+						$tmp2 = $this->retrieve_constant_lang($app_services[$i]['whereamiused'][$k]['button_label'], $_SESSION['config']['businessapppath'].'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].".php");
+						if($tmp2 <> false)
+						{
+							$tmp = $tmp2;
+						}
+						?>
+                        <input type="button" name="<?php  echo $app_services[$i]['id'];?>" value="<?php  echo $tmp;?>" onclick="window.open('<?php  echo $_SESSION['config']['businessappurl'].$app_services[$i]['servicepage'];?>', '<?php  echo $app_services[$i]['id'];?>','width=<?php  echo $app_services[$i]['whereamiused'][$k]['width'];?>,height=<?php  echo $app_services[$i]['whereamiused'][$k]['height'];?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
+                        <?php
+					}
+					elseif($app_services[$i]['whereamiused'][$k]['nature'] == "include" && $_SESSION['user']['services'][$app_services[$i]['id']] && ($servicenature == "all" || $servicenature == "include") && !in_array($app_services[$i]['id'],$executed_services))
+					{
+						array_push($executed_services, $app_services[$i]['id']);
+						include($_SESSION['config']['businessapppath'].$app_services[$i]['servicepage']);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	* Loads the html declaration and doctype
+	*/
+	public function load_html()
+	{
+		?>
+        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
+		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php  echo $_SESSION['config']['lang']; ?>" lang="<?php  echo $_SESSION['config']['lang']; ?>">
+        <?php
+	}
+
+	/**
+	* Loads the html header
+	*
+	* @param  $title string Title tag value (empty by default)
+	*/
+	public function load_header( $title = '', $load_css = true, $load_js = true)
+	{
+		if(empty($title))
+		{
+			 $title = $_SESSION['config']['applicationname'];
+		}
+		?>
+        <head>
+            <title><?php  echo $title;?></title>
+            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+            <meta http-equiv="Content-Language" content="<?php  echo $_SESSION['config']['lang'];?>" />
+			<link rel="icon" type="image/png" href="<?php echo $_SESSION['config']['businessappurl'];?>img/favicon.png"/>
+            <?php
+            if($load_css)
+            {
+				$this->load_css();
+			}
+			if($load_js)
+			{
+				$this->load_js();
+			}
+			?>
+        </head>
+		<?php
+	}
+
+	/**
+	* Loads the modules and aplication css
+	*/
+	private function load_css()
+	{
+		?>
+        <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['css']; ?>" media="screen" />
+
+        <!--[if lt IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['css_IE']; ?>" media="screen" />  <![endif]-->
+        <!--[if gte IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['css_IE7']; ?>" media="screen" />  <![endif]-->
+        <?php
+		foreach(array_keys($_SESSION['modules_loaded']) as $value)
+		{
+			$url_css = $_SESSION['urltomodules'].$_SESSION['modules_loaded'][$value]['name']."/css/module.css";
+			$path_css = $_SESSION['pathtomodules'].$_SESSION['modules_loaded'][$value]['name'].DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."module.css";
+			$url_cssIE = $_SESSION['urltomodules'].$_SESSION['modules_loaded'][$value]['name']."/css/module_IE.css";
+			$path_cssIE = $_SESSION['pathtomodules'].$_SESSION['modules_loaded'][$value]['name'].DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."module_IE.css";
+			$url_cssIE7 = $_SESSION['urltomodules'].$_SESSION['modules_loaded'][$value]['name']."/css/module_IE7.css";
+			$path_cssIE7 = $_SESSION['pathtomodules'].$_SESSION['modules_loaded'][$value]['name'].DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."module_IE7.css";
+			if(file_exists($path_css))
+			{
+				?>
+				<link rel="stylesheet" type="text/css" href="<?php  echo $url_css ; ?>" media="screen" />
+				<?php
+			}
+			if(file_exists($path_cssIE))
+			{
+				?>
+				<!--[if lt IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $url_cssIE ; ?>" media="screen" />  <![endif]-->
+				<?php
+			}
+			if(file_exists($path_cssIE7))
+			{
+				?>
+				<!--[if gte IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $url_cssIE7; ?>" media="screen" />  <![endif]-->
+				<?php
+			}
+		}
+	}
+
+	/**
+	* Loads the javascript files of the application and modules
+	*/
+	private function load_js()
+	{
+		?>
+		<script type="text/javascript" >
+			var app_path = '<?php  echo $_SESSION['config']['businessappurl'];?>';
+		</script>
+		<?php
+		if(file_exists($_SESSION['config']['businessapppath']."js".DIRECTORY_SEPARATOR."functions.js"))
+		{
+			?>
+			<script type="text/javascript" src="<?php  echo $_SESSION['config']['businessappurl'];?>js/functions.js"></script>
+			<?php
+		}
+		foreach(array_keys($_SESSION['modules_loaded']) as $value)
+		{
+			$url_js = $_SESSION['urltomodules'].$_SESSION['modules_loaded'][$value]['name']."/js/functions.js";
+			$path_js = $_SESSION['pathtomodules'].$_SESSION['modules_loaded'][$value]['name'].DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."functions.js";
+			if(file_exists($path_js))
+			{
+				?>
+				<script type="text/javascript" src="<?php  echo $url_js;?>"></script>
+				<?php
+			}
+		}
+	}
+
+	/**
+	* Cleans the page variable and looks if she exists or not before including her
+	*
+	*/
+	public function insert_page()
+	{
+		// Cleans the page variables and looks if she exists or not before including her
+		if(isset($_GET['page']))
+		{
+			$this->f_page = $this->wash($_GET['page'],"file","","yes");
+		}
+		else
+		{
+			$this->f_page = "step1";
+		}
+		// Page is defined in a module
+		if(isset($_GET['module']) && $_GET['module'] <> "core")
+		{
+			$path = $_SESSION['pathtomodules'].$_GET['module'].DIRECTORY_SEPARATOR.$this->f_page.".php";
+			if(file_exists($path))
+			{
+				require($path);
+			}
+			else
+			{
+				//require($_SESSION["config"]["defaultPage"].".php");
+				$this->loadDefaultPage();
+			}
+		}
+		// Page is defined the core
+		elseif(isset($_GET['module']) && $_GET['module'] == "core")
+		{
+			if(file_exists($_SESSION['pathtocore'].$this->f_page.".php"))
+			{
+				require($_SESSION['pathtocore'].$this->f_page.".php");
+			}
+			else
+			{
+				//require($_SESSION["config"]["defaultPage"].".php");
+				$this->loadDefaultPage();
+			}
+		}
+		// Page is defined the admin directory of the application
+		elseif(isset($_GET['admin']) && !empty($_GET['admin']))
+		{
+			$path = $_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR.trim($_GET['admin']).DIRECTORY_SEPARATOR.$this->f_page.'.php';
+			if(file_exists($path))
+			{
+				require($path);
+			}
+			else
+			{
+				//require($_SESSION["config"]["defaultPage"].".php");
+				$this->loadDefaultPage();
+			}
+		}
+		elseif(isset($_GET['dir']) && !empty($_GET['dir']))
+		{
+			$path = $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.trim($_GET['dir']).DIRECTORY_SEPARATOR.$this->f_page.'.php';
+			if(file_exists($path))
+			{
+				require($path);
+			}
+			else
+			{
+				//require($_SESSION["config"]["defaultPage"].".php");
+				$this->loadDefaultPage();
+			}
+		}
+		// Page is defined in the application
+		else
+		{
+			if(file_exists($this->f_page.".php"))
+			{
+				require($this->f_page.".php");
+			}
+			else
+			{
+				require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php");
+				$app = new business_app_tools();
+				$path = $app->insert_app_page($this->f_page);
+				if( !$path || !file_exists($path))
+				{
+					//require($_SESSION["config"]["defaultPage"].".php");
+					$this->loadDefaultPage();
+				}
+				else
+				{
+					require($path);
+				}
+			}
+		}
+	}
+
+	/**
+	* Loads the default page
+	*/
+	public function loadDefaultPage()
+	{
+		if(trim($_SESSION['target_page']) <> "" && trim($_SESSION['target_module']) <> "")
+		{
+			$target = "page=".$_SESSION['target_page']."&module=".$_SESSION['target_module'];
+		}
+		elseif(trim($_SESSION['target_page']) <> "" && trim($_SESSION['target_admin']) <> "")
+		{
+			$target = "page=".$_SESSION['target_page']."&admin=".$_SESSION['target_admin'];
+		}
+		elseif(trim($_SESSION['target_page']) <> "" && trim($_SESSION['target_module']) == "" && trim($_SESSION['target_admin']) == "")
+		{
+			$target = "page=".$_SESSION['target_page'];
+		}
+		$_SESSION['target_page'] = "";
+		$_SESSION['target_module'] = "";
+		$_SESSION['target_admin'] = "";
+		if(trim($target) <> "")
+		{
+			$tmpTab = array();
+			$tmpTab = explode("&", $target);
+			if(count($tmpTab) == 1)
+			{
+				$page = str_replace("page=", "", $tmpTab[0]);
+				require($page.".php");
+			}
+			elseif(count($tmpTab) == 2)
+			{
+				$tabPage = array();
+				$tabModuleOrAdmin = array();
+				$tabPage = explode("=", $tmpTab[0]);
+				$tabModuleOrAdmin = explode("=", $tmpTab[1]);
+				if($tabModuleOrAdmin[0] == "module")
+				{
+					require($_SESSION['pathtomodules'].$tabModuleOrAdmin[1].DIRECTORY_SEPARATOR.$tabPage[1].".php");
+				}
+				else
+				{
+					//admin case
+					if($tabPage[1] == "users" || $tabPage[1] == "groups" || $tabPage[1] == "admin_archi" || $tabPage[1] == "history" || $tabPage[1] == "history_batch"
+					   || $tabPage[1] == "status" || $tabPage[1] == "action" || $tabPage[1] == "xml_param_services" || $tabPage[1] == "modify_user"
+					  )
+					{
+						require($_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR.$tabModuleOrAdmin[1].DIRECTORY_SEPARATOR.$tabPage[1].".php");
+					}
+					else
+					{
+						require("welcome.php");
+					}
+				}
+			}
+			else
+			{
+				require("welcome.php");
+			}
+		}
+		elseif(trim($_SESSION["config"]["defaultPage"]) <> "")
+		{
+			$tmpTab = array();
+			$tmpTab = explode("&", $_SESSION["config"]["defaultPage"]);
+			if(count($tmpTab) == 1)
+			{
+				$page = str_replace("page=", "", $tmpTab[0]);
+				require($page.".php");
+			}
+			elseif(count($tmpTab) == 2)
+			{
+				$tabPage = array();
+				$tabModuleOrAdmin = array();
+				$tabPage = explode("=", $tmpTab[0]);
+				$tabModuleOrAdmin = explode("=", $tmpTab[1]);
+				if($tabModuleOrAdmin[0] == "module")
+				{
+					require($_SESSION['pathtomodules'].$tabModuleOrAdmin[1].DIRECTORY_SEPARATOR.$tabPage[1].".php");
+				}
+				else
+				{
+					require($_SESSION['config']['businessapppath']."admin".DIRECTORY_SEPARATOR.$tabModuleOrAdmin[1].DIRECTORY_SEPARATOR.$tabPage[1].".php");
+				}
+			}
+			else
+			{
+				require("welcome.php");
+			}
+		}
+		else
+		{
+			require("welcome.php");
+		}
+	}
+
+	/**
+	* Loads the footer
+	*/
+	public function load_footer()
+	{
+		?>
+		Powered by Maarch&trade;. <?php  $this->show_page_stat(); ?>
+        <?php
+	}
+
+	/**
+	* Views Cookies informations, POST and SESSION variables if the mode debug is enabled in the application config
+	*/
+	public function view_debug()
+	{
+		if($_SESSION['config']['debug'] == "true")
+		{
+			?>
+			<div id="debug">
+                <h2 class="tit">Debug Mode</h2>
+                <div class="debugheader">COOKIE</div>
+                    <?php
+                    $this->show_array($_COOKIE);
+                    ?>
+                	<h2 class="tit">POST</h2>
+                    <?php
+                    $this->show_array($_POST);
+                    ?>
+                	<h2 class="tit">SESSION</h2>
+                    <?php
+                    $this->show_array($_SESSION);
+                    ?>
+			</div>
+			<?php
+		}
+	}
+
+	/**
+	* Tests if the current user is defined in the current session
+	*/
+	public function test_user()
+	{
+		if(!isset($_SESSION['user']['UserId']))
+		{
+			if(trim($_SERVER['argv'][0]) <> "")
+			{
+				header("location: reopen.php?".$_SERVER['argv'][0]);
+			}
+			else
+			{
+				header("location: reopen.php");
+			}
+			exit;
+		}
+	}
+
+	/**
+	* Tests if the module is loaded
+	*
+	* @param  $module_id  string Module identifier the module to test
+	* @return bool True if the module is found, False otherwise
+	*/
+	public function is_module_loaded($module_id)
+	{
+		foreach(array_keys($_SESSION['modules_loaded']) as $value)
+		{
+			if($value == $module_id && $_SESSION['modules_loaded'][$value]['loaded'] == "true")
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+
+
+	/**
+	* Retrieves the label corresponding to a service
+	*
+	* @param  $id_service string Service identifier
+	* @return string Service Label or  _NO_LABEL_FOUND value
+	*/
+	public function retrieve_label_service($id_service)
+	{
+		for($i=0;$i<count($_SESSION['enabled_services']);$i++)
+		{
+			if($_SESSION['enabled_services'][$i]['id'] == $id_service)
+			{
+				return $_SESSION['enabled_services'][$i]['label'];
+			}
+		}
+		return _NO_LABEL_FOUND;
+	}
+
+	/**
+	* Tests if the user has admin rights on the service
+	*
+	* @param  $id_service string Service identifier
+	* @param  $module string Module identifier or "apps"
+	* @param  $redirect bool If true the user is redirected in the index page, else no redirection (True by default)
+	* @return bool or redirection depending on the $redirect value
+	*/
+	public function test_admin($id_service, $module, $redirect = true )
+	{
+
+		// Application service
+		if($module == "apps")
+		{
+			$system = false;
+			for($i=0; $i< count($_SESSION['apps_services']); $i++)
+			{
+				if($_SESSION['apps_services'][$i]['system_service'])
+				{
+					return true;
+				}
+			}
+		}
+		// Module service
+		else
+		{
+			if(!$this->is_module_loaded($module))
+			{
+				if($redirect)
+				{
+					$_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service;
+					?>
+					<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+					<?php
+					exit();
+				}
+				else
+				{
+					return false;
+				}
+			}
+			else
+			{
+				$system = false;
+				for($i=0; $i< count($_SESSION['modules_services'][$module]); $i++)
+				{
+					if($_SESSION['modules_services'][$module][$i]['id'] == $id_service)
+					{
+						if($_SESSION['modules_services'][$module][$i]['system_service'] == true)
+						{
+							return true;
+						}
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+		}
+		if(! isset($_SESSION['user']['services'][$id_service]) )
+		{
+			if($redirect)
+			{
+				$_SESSION['error'] = _ADMIN_SERVICE.' '._UNKNOWN;
+			?>
+				<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+				<?php
+				exit();
+			}
+			else
+			{
+				return false;
+			}
+		}
+		else
+		{
+			if( $_SESSION['user']['services'][$id_service] == false)
+			{
+				if($redirect)
+				{
+					$label = $this->retrieve_label_service($id_service);
+					$_SESSION['error'] = _NO_RIGHTS_ON.' : '.$label;
+					?>
+					<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+					<?php
+					exit();
+				}
+				else
+				{
+					return false;
+				}
+			}
+			else
+			{
+				return true;
+			}
+		}
+	}
+
+	/**
+	* Tests if the user has right on the service
+	*
+	* @param  $id_service string Service identifier
+	* @param  $module string Module identifier or "apps"
+	* @param  $redirect bool If true the user is redirected in the index page, else no redirection (True by default)
+	* @return bool or redirection depending on the $redirect value
+	*/
+	public function test_service($id_service, $module, $redirect = true)
+	{
+		// Application service
+		if($module == "apps")
+		{
+			$system = false;
+			for($i=0; $i< count($_SESSION['apps_services']); $i++)
+			{
+				if($_SESSION['apps_services'][$i]['system_service'])
+				{
+					return true;
+				}
+			}
+		}
+		// Module service
+		else
+		{
+			if(!$this->is_module_loaded($module))
+			{
+				if($redirect)
+				{
+					$_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service;
+				?>
+					<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+					<?php
+					exit();
+
+				}
+				else
+				{
+					return false;
+				}
+			}
+			else
+			{
+				$system = false;
+				for($i=0; $i< count($_SESSION['modules_services'][$module]); $i++)
+				{
+					if($_SESSION['modules_services'][$module][$i]['id'] == $id_service)
+					{
+						if($_SESSION['modules_services'][$module][$i]['system_service'] == true)
+						{
+							return true;
+						}
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+		}
+		if(! isset($_SESSION['user']['services'][$id_service]) )
+		{
+			if($redirect)
+			{
+				$_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service;
+			?>
+				<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+				<?php
+				exit();
+
+			}
+			else
+			{
+				return false;
+			}
+		}
+		else
+		{
+			if( $_SESSION['user']['services'][$id_service] == false)
+			{
+				if($redirect)
+				{
+					$label = $this->retrieve_label_service($id_service);
+					$_SESSION['error'] = _NO_RIGHTS_ON.' : '.$label;
+					?>
+					<script type="text/javascript" language="javascript">window.top.location.href='<?php  echo $_SESSION['config']['businessappurl'];?>index.php';</script>
+					<?php
+					exit();
+				}
+				else
+				{
+					return false;
+				}
+			}
+			else
+			{
+				return true;
+			}
+		}
+	}
+
+	/**
+	* Gets the time of session expiration
+	*
+	* @return string time of session expiration
+	*/
+	public function get_session_time_expire()
+	{
+		$time = 0;
+		if(ini_get('session.cache_expire') > $_SESSION['config']['cookietime'])
+		{
+			$time = $_SESSION['config']['cookietime'];
+		}
+		else
+		{
+			$time = ini_get('session.cache_expire');
+		}
+		return $time;
+	}
+
+	/**
+	* Executes  services preprocess in background in the  page
+	*
+	* @param  $modules_services array Enabled services
+	* @param  $whereami  string Page where to execute the preprocess
+	*/
+	public function execute_preprocess_of_services_in_background($modules_services, $whereami)
+	{
+		$process_view = array();
+		foreach(array_keys($modules_services) as $value)
+		{
+			for($i=0;$i<count($modules_services[$value]);$i++)
+			{
+				for($k=0;$k<count($modules_services[$value][$i]['processinbackground']);$k++)
+				{
+					if($modules_services[$value][$i]['processinbackground'][$k]['page'] == $whereami && $modules_services[$value][$i]['processinbackground'][$k]['preprocess'] <> "")
+					{
+						$process_order = $modules_services[$value][$i]['processinbackground'][$k]['processorder'];
+						$process_view[$process_order]['preprocess'] = $_SESSION['pathtomodules'].$value.DIRECTORY_SEPARATOR.$modules_services[$value][$i]['processinbackground'][$k]['preprocess'];
+						$process_view[$process_order]['id_service'] = $modules_services[$value][$i]['id'];
+					}
+				}
+			}
+		}
+		sort($process_view);
+
+		for($u=0;$u<=count($process_view);$u++)
+		{
+			if($process_view[$u]['preprocess'] <> "")
+			{
+				include($process_view[$u]['preprocess']);
+			}
+		}
+	}
+
+	/**
+	* Executes services postprocess  in background in the page
+	*
+	* @param  $modules_services array Enabled services
+	* @param  $whereami  string Page where execute the postprocess
+	*/
+	public function execute_postprocess_of_services_in_background($modules_services, $whereami)
+	{
+		$process_view = array();
+		foreach(array_keys($modules_services) as $value)
+		{
+			for($i=0;$i<count($modules_services[$value]);$i++)
+			{
+				for($k=0;$k<count($modules_services[$value][$i]['processinbackground']);$k++)
+				{
+					if($modules_services[$value][$i]['processinbackground'][$k]['page'] == $whereami && $modules_services[$value][$i]['processinbackground'][$k]['postprocess'] <> "")
+					{
+						$process_order = $modules_services[$value][$i]['processinbackground'][$k]['processorder'];
+						$process_view[$process_order]['postprocess'] = $_SESSION['pathtomodules'].$value.DIRECTORY_SEPARATOR.$modules_services[$value][$i]['processinbackground'][$k]['postprocess'];
+					}
+				}
+			}
+		}
+		sort($process_view);
+		for($u=0;$u<=count($process_view);$u++)
+		{
+			if($process_view[$u]['postprocess'] <> "")
+			{
+				include($process_view[$u]['postprocess']);
+			}
+		}
+	}
+
+	/**
+	* Executes application preprocess  services in background in the page
+	*
+	* @param  $modules_services array Enabled services
+	* @param  $whereami string Page where to execute the preprocess
+	*/
+	public function execute_preprocess_of_apps_services_in_background($app_services, $whereami)
+	{
+		$process_view = array();
+		for($i=0;$i<count($app_services);$i++)
+		{
+			for($k=0;$k<count($app_services[$i]['processinbackground']);$k++)
+			{
+				if($app_services[$i]['processinbackground'][$k]['page'] == $whereami && $app_services[$i]['processinbackground'][$k]['preprocess'] <> "")
+				{
+					$process_order = $app_services[$i]['processinbackground'][$k]['processorder'];
+					$process_view[$process_order]['preprocess'] = $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.$app_services[$i]['processinbackground'][$k]['preprocess'];
+					$process_view[$process_order]['id_service'] = $app_services[$i]['id'];
+				}
+			}
+		}
+		sort($process_view);
+		for($u=0;$u<=count($process_view);$u++)
+		{
+			if($process_view[$u]['preprocess'] <> "")
+			{
+				include($process_view[$u]['preprocess']);
+			}
+		}
+	}
+
+	/**
+	* Executes the application postprocess  services in background in the page
+	*
+	* @param  $modules_services array Enabled services
+	* @param  $whereami string Page where to execute the postprocess
+	*/
+	public function execute_postprocess_of_apps_services_in_background($app_services, $whereami)
+	{
+		$process_view = array();
+		for($i=0;$i<count($app_services);$i++)
+		{
+			for($k=0;$k<count($app_services[$i]['processinbackground']);$k++)
+			{
+				if($app_services[$i]['processinbackground'][$k]['page'] == $whereami && $app_services[$i]['processinbackground'][$k]['postprocess'] <> "")
+				{
+					$process_order = $app_services[$i]['processinbackground'][$k]['processorder'];
+					$process_view[$process_order]['postprocess'] = $_SESSION['config']['businessapppath'].DIRECTORY_SEPARATOR.$app_services[$i]['processinbackground'][$k]['postprocess'];
+					$process_view[$process_order]['id_service'] = $app_services[$i]['id'];
+				}
+			}
+		}
+		sort($process_view);
+
+		for($u=0;$u<=count($process_view);$u++)
+		{
+			if($process_view[$u]['postprocess'] <> "")
+			{
+				include($process_view[$u]['postprocess']);
+			}
+		}
+	}
+
+	/**
+	* Gets the page corresponding to the service
+	*
+	* @param  $id_service  string Service identifier
+	* @param  $origin string Service origin : MODULE or APPS
+	* @param  $id_module string Module identifier(empty by default)
+	* @return Service page or False
+	*/
+	public function get_service_page($id_service, $origin, $id_module = '')
+	{
+		if(trim(strtoupper($origin)) == "MODULE")
+		{
+			if(empty($id_module))
+			{
+				$_SESSION['error'] = _ID_MODULE.' '._MISSING;
+				return false;
+			}
+			for($i=0; $i<count($_SESSION['modules_services'][$id_module]);$i++)
+			{
+				if($_SESSION['modules_services'][$id_module][$i]['id'] == trim($id_service))
+				{
+					if(isset($_SESSION['modules_services'][$id_module][$i]['servicepage']) && !empty($_SESSION['modules_services'][$id_module][$i]['servicepage']))
+					{
+						return $_SESSION['modules_services'][$id_module][$i]['servicepage'];
+					}
+					else
+					{
+						$_SESSION['error'] = _SERVICE_PAGE_NOT_DEFINED_EMPTY;
+						return false;
+					}
+				}
+			}
+		}
+		elseif(trim(strtoupper($origin)) == "APPS")
+		{
+			for($i=0; $i<count($_SESSION['apps_services']);$i++)
+			{
+				if($_SESSION['apps_services'][$i]['id'] == trim($id_service))
+				{
+					if(isset($_SESSION['apps_services'][$i]['servicepage']) && !empty($_SESSION['apps_services'][$i]['servicepage']))
+					{
+						return $_SESSION['apps_services'][$i]['servicepage'];
+					}
+					else
+					{
+						$_SESSION['error'] = _SERVICE_PAGE_NOT_DEFINED_EMPTY;
+						return false;
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	* Gets the path of an action
+	*
+	* @param  $id_service  string Action identifier
+	* @return Action page or action identifier if not found
+	*/
+	public function get_path_action_page($action_id)
+	{
+		$found = false;
+		$ind = -1;
+		for($i=0; $i< count($_SESSION['actions_pages']); $i++)
+		{
+			if($_SESSION['actions_pages'][$i]['ID'] == $action_id)
+			{
+				$found = true;
+				$ind = $i;
+				break;
+			}
+		}
+		if(!$found)
+		{
+			return $action_id;
+		}
+		else
+		{
+			$path = $action_id;
+			if(strtoupper($_SESSION['actions_pages'][$ind]['ORIGIN']) == "APPS")
+			{
+				$path = $_SESSION['config']['businessapppath']."actions".DIRECTORY_SEPARATOR.$_SESSION['actions_pages'][$ind]['NAME'].".php";
+			}
+			elseif(strtoupper($_SESSION['actions_pages'][$ind]['ORIGIN']) == "MODULE")
+			{
+				$path = $_SESSION['pathtomodules'].$_SESSION['actions_pages'][$ind]['MODULE'].DIRECTORY_SEPARATOR.$_SESSION['actions_pages'][$ind]['NAME'].".php";
+			}
+			return $path;
+		}
+	}
+
+	/**
+	* Gets the url of an action
+	*
+	* @param  $id_service  string Action identifier
+	* @return Action url or action identifier if not found
+	*/
+
+	public function get_url_action_page($action_id)
+	{
+		$found = false;
+		$ind = -1;
+		for($i=0; $i< count($_SESSION['actions_pages']); $i++)
+		{
+			if($_SESSION['actions_pages'][$i]['ID'] == $action_id)
+			{
+				$found = true;
+				$ind = $i;
+				break;
+			}
+		}
+		if(!$found)
+		{
+			return $action_id;
+		}
+		else
+		{
+			$path = $action_id;
+			if(strtoupper($_SESSION['actions_pages'][$ind]['ORIGIN']) == "APPS")
+			{
+				$path = $_SESSION['config']['businessappurl'].$_SESSION['actions_pages'][$ind]['NAME'].".php";
+			}
+			elseif(strtoupper($_SESSION['actions_pages'][$ind]['ORIGIN']) == "MODULE")
+			{
+				$path = $_SESSION['urltomodules'].$_SESSION['actions_pages'][$ind]['MODULE'].'/'.$_SESSION['actions_pages'][$ind]['NAME'].".php";
+			}
+			return $path;
+		}
+	}
+
+	public function is_action_defined($action_id)
+	{
+		require_once($_SESSION['pathtocoreclass'].'class_db.php');
+		if(empty($action_id))
+		{
+			return false;
+		}
+		$db = new dbquery();
+		$db->connect();
+		$db->query("select origin from ".$_SESSION['tablename']['actions']." where id = ".$action_id);
+		$res = $db->fetch_object();
+		$origin = $res->origin;
+
+		if($origin == 'apps' || $origin == 'core')
+		{
+			return true;
+		}
+		for($i=0; $i<count($_SESSION['modules']);$i++)
+		{
+			if($_SESSION['modules'][$i]['moduleid'] == $origin)
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_db.php b/core/trunk/core/class/class_db.php
new file mode 100644
index 00000000000..a83c48b925d
--- /dev/null
+++ b/core/trunk/core/class/class_db.php
@@ -0,0 +1,614 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Embedded sql functions (connection, database selection, query ). Allow to changes the databases server
+*
+* @file
+* @author  Claire Figueras <dev@maarch.org>
+* @author  Laurent Giovannoni  <dev@maarch.org>
+* @author  Loic Vinet <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Embedded sql functions (connection, database selection, query ). Allow to changes the databases server
+*
+* <ul>
+*  <li>Compatibility with the following databases : Mysql, Postgres, Mssql Server, Oracle
+*  <li>Connection to the Maarch database</li>
+* <li>Execution of SQL queries to the Maarch database</li>
+* <li>Getting results of SQL queries</li>
+* <li>Managing the database errors</li>
+* </ul>
+* @ingroup core
+*/
+class dbquery extends functions
+{
+	/**
+	* Debug mode activation.
+	* Integer 1,0
+         */
+	private $debug;				// debug mode
+
+	/**
+	* Debug query (debug mode). String
+	*/
+	private $debug_query;		// request for the debug mode
+
+	/**
+	* SQL link identifier
+	* Integer
+	*/
+	private $sql_link;			// sql link identifier
+
+
+	/**
+	* To know where the script was stopped
+	*  Integer
+	*/
+	private $what_sql_error;	// to know where the script was stopped
+
+	/**
+	* SQL query
+	* String
+         */
+	public $query;				// query
+
+	/**
+	* Number of queries made with this identifier
+         * Integer
+         */
+	private $nb_query;			// number of queries made with this identifier
+
+	/**
+	* Sent query result
+         * String
+         */
+	private $result;			// sent query result
+	
+	/**
+	* OCI query identifier
+	* @access private
+	* @var integer
+	*/
+	private $statement	;		// OCI query identifier
+
+	private $server;
+	private $port;
+	private $user;
+	private $pass;
+	private $base;
+	private $databasetype;
+	//private $workspace;
+
+	function __construct()
+	{
+		$args = func_get_args();
+		if(count($args) < 1)
+		{
+			$this->server = $_SESSION['config']['databaseserver'];
+			$this->port = $_SESSION['config']['databaseserverport'];
+			$this->user = $_SESSION['config']['databaseuser'];
+			$this->pass = $_SESSION['config']['databasepassword'];
+			$this->base = $_SESSION['config']['databasename'];
+			//$this->workspace = $_SESSION['config']['databaseworkspace'];
+			$this->databasetype = $_SESSION['config']['databasetype'];
+		}
+		else
+		{
+			$error_args = true;
+			if(is_array($args[0]))
+			{
+				if(!isset($args[0]['server']))
+				{
+					$this->server = '127.0.0.1';
+				}
+				else
+				{
+					$this->server = $args[0]['server'];
+				}
+				if(!isset($args[0]['databasetype']))
+				{
+					$this->databasetype = 'MYSQL';
+				}
+				else
+				{
+					$this->databasetype = $args[0]['databasetype'];
+				}
+				if(!isset($args[0]['port']))
+				{
+					$this->port = '3304';
+				}
+				else
+				{
+					$this->port = $args[0]['port'];
+				}
+				if(!isset($args[0]['user']))
+				{
+					$this->user = 'root';
+				}
+				else
+				{
+					$this->user = $args[0]['user'];
+				}
+				//if(!isset($args[0]['workspace']))
+				//{
+				//	$this->workspace = 'public';
+				//}
+				//else
+				//{
+				//	$this->workspace = $args[0]['workspace'];
+				//}
+				if(!isset($args[0]['pass']))
+				{
+					$this->pass = '';
+				}
+				else
+				{
+					$this->pass = $args[0]['pass'];
+				}
+				if(!isset($args[0]['base']))
+				{
+					$this->base = '';
+				}
+				else
+				{
+					$this->base = $args[0]['base'];
+				}
+				$error_args = false;
+			}
+			else if(is_string($args[0]) && file_exists($args[0]))
+			{
+				$xmlconfig = simplexml_load_file($args[0]);
+				$CONFIG = $xmlconfig->CONFIG_BASE;
+				$this->server = (string) $CONFIG->databaseserver;
+				$this->port = (string) $CONFIG->databaseserverport;
+				$this->databasetype = (string) $CONFIG->databasetype;
+				$this->base= (string) $CONFIG->databasename;
+				$this->user = (string) $CONFIG->databaseuser;
+				$this->pass = (string) $CONFIG->databasepassword;
+				//if (isset($CONFIG->databaseworkspace)) 
+				//	$this->workspace = (string) $CONFIG->databaseworkspace;
+				$error_args = false;
+			}
+			if($error_args)
+			{
+				$this->what_sql_error = 5; // error constructor
+				$this->error();
+			}
+		}
+	}
+	/**
+	* Connects to the database
+	*
+	*/
+	public function connect()
+	{
+		$this->debug = 0;
+		$this->nb_query = 0;
+		if($this->databasetype == "MYSQL")
+		{
+			$this->sql_link = @mysqli_connect($this->server,$this->user,$this->pass, $this->base, $this->port);
+		}
+		elseif($this->databasetype== "SQLSERVER")
+		{
+			$this->sql_link = @mssql_connect($this->server,$this->user,$this->pass);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			$this->sql_link = @pg_connect("host=".$this->server." user=".$this->user." password=".$this->pass." dbname=".$this->base." port=".$this->port);
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			$this->sql_link = oci_connect($this->user, $this->pass, "//".$this->server."/".$this->base,'UTF8');
+			//$this->sql_link = oci_connect($user, $pass, $this->base ,'UTF8');
+			$this->query("alter session set nls_date_format='dd-mm-yyyy'");
+		}
+		else
+		{
+			$this->sql_link = FALSE;
+		}
+
+		if(!$this->sql_link)
+		{
+			$this->what_sql_error = 1; // error connexion
+			$this->error();
+		}
+		else
+		{
+			if($this->databasetype <> "POSTGRESQL" && $this->databasetype <> "MYSQL" && $this->databasetype <> "ORACLE")
+			{
+				$this->select_db();
+			}
+		}
+	}
+
+	/**
+	* Database selection (only for SQLSERVER)
+	*
+	*/
+	public function select_db()
+	{
+		if($this->databasetype == "SQLSERVER")
+		{
+			if(!@mssql_select_db($this->base))
+			{
+				$this->what_sql_error = 2;
+				$this->error();
+			}
+		}
+	}
+
+	/**
+	* Execution the sql query
+	*
+	* @param  $q_sql string SQL query
+	* @param  $catch_error bool In case of error, catch the error or not, if not catched, the error is displayed (false by default)
+	*/
+	public function query($q_sql, $catch_error = false)
+	{
+		// query
+		$this->debug_query = $q_sql;
+		if($this->databasetype == "MYSQL")
+		{
+			$this->query = @mysqli_query($this->sql_link,$q_sql);
+		}
+		elseif($this->databasetype== "SQLSERVER")
+		{
+			$this->query = @mssql_query($q_sql);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			$this->query = @pg_query($q_sql);
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			$this->statement = oci_parse($this->sql_link, $q_sql);
+			if($this->statement == false)
+			{ 
+				$this->what_sql_error = 5;
+				$this->error();
+				exit();
+			}
+			else
+			{
+				if (!@oci_execute($this->statement))
+				{
+					$error = oci_error($this->statement);
+					print_r($error);
+				}
+			}
+			
+		}
+		else
+		{
+			$this->query = false;
+
+		}
+		if ((($this->databasetype == "ORACLE" && $this->statement == false)|| ($this->databasetype <> "ORACLE" && $this->query == false))  && !$catch_error)
+		//if($this->query == false && !$catch_error)
+		{
+			$this->what_sql_error = 3;
+			$this->error();
+		}
+		$this->nb_query++;
+		if($this->databasetype == "ORACLE")
+			return $this->statement;
+		else	
+			return $this->query;
+	}
+
+	/**
+	* Returns the query results in an object
+	*
+	* @return Object
+	*/
+	public function fetch_object()
+	{
+		if($this->databasetype == "MYSQL")
+		{
+            return @mysqli_fetch_object($this->query);
+		}
+		elseif($this->databasetype == "SQLSERVER")
+		{
+			return @mssql_fetch_object($this->query);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			return @pg_fetch_object($this->query);
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			$myObject = @oci_fetch_object($this->statement);
+			if(isset($myObject) && !empty($myObject))
+			{
+				foreach($myObject as $key => $value)
+				{
+					$key2 = strtolower($key);
+					$myLowerObject->$key2 = $myObject->$key;
+				}
+				return $myLowerObject;
+			}
+			else
+			{
+				return false;
+			}
+		}
+		else
+		{
+
+		}
+	}
+
+	/**
+	* Returns the query results in an array
+	*
+	* @return array
+	*/
+	public function fetch_array()
+	{
+		if($this->databasetype == "MYSQL")
+		{
+           return @mysqli_fetch_array($this->query);
+		 }
+		elseif($this->databasetype == "SQLSERVER")
+		{
+			return @mssql_fetch_array($this->query);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			return @pg_fetch_array($this->query);
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			$tmp_statement = array();
+			$tmp_statement = @oci_fetch_array($this->statement);
+			if (is_array($tmp_statement))
+			{
+				return array_change_key_case($tmp_statement ,CASE_LOWER);
+			}
+		}
+		else
+		{
+
+		}
+	}
+
+	/**
+	* Returns the query results in a row
+	*
+	* @return array
+	*/
+	public function fetch_row()
+	{
+		if($this->databasetype== "MYSQL")
+		{
+            return @mysqli_fetch_row($this->query);
+		}
+		elseif($this->databasetype == "SQLSERVER")
+		{
+			return @mssql_fetch_row($this->query);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			return @pg_fetch_row($this->query);
+		}
+		elseif($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+			return @oci_fetch_row($this->statement);
+		}
+		else
+		{
+
+		}
+	}
+
+	/**
+	* Returns the number of results for the current query
+	*
+	* @return integer Results number
+	*/
+	public function nb_result()
+	{
+		if($this->databasetype== "MYSQL")
+		{
+		   return @mysqli_num_rows($this->query);
+		}
+		elseif($this->databasetype== "SQLSERVER")
+		{
+			return @mssql_num_rows($this->query);
+		}
+		elseif($this->databasetype== "POSTGRESQL")
+		{
+			return @pg_num_rows($this->query);
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			$db = new dbquery();
+			$db->connect();
+			$db->query($this->debug_query);			
+			$nb=0;
+			while($line = $db->fetch_object($db))
+			{
+				$nb++;
+			}		
+			return $nb;
+		}
+		else
+		{
+				
+		}
+	}
+
+	/**
+	* Closes database connexion
+	*
+	*/
+	public function close_conn()
+	{
+		if($this->databasetype == "MYSQL")
+		{
+			if(!mysqli_close($this->sql_link))
+			{
+				$this->what_sql_error = 4;
+				$this->error();
+			}
+		}
+		elseif($this->databasetype == "SQLSERVER")
+		{
+			 if(!mssql_close($this->sql_link))
+			{
+				$this->what_sql_error = 4;
+				$this->error();
+			}
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+			 if(!pg_close($this->sql_link))
+			{
+				$this->what_sql_error = 4;
+				$this->error();
+			}
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+			 if(!oci_close($this->sql_link))
+			{
+				$this->what_sql_error = 4;
+				$this->error();
+			}
+		}
+		else
+		{
+
+		}
+	}
+
+	/**
+	* SQL Error management
+	*
+	*/
+	private function error()
+	{
+		// Connexion error
+		if($this->what_sql_error == 1)
+		{
+			// Shows the connexion data (server, port, user, pass)
+			echo "- <b>"._DB_CONNEXION_ERROR."</b> -<br /><br />"._DATABASE_SERVER." : ".$this->server."<br/>"._DB_PORT.' : '.$this->port."<br/>"._DB_TYPE." : ".$this->databasetype."<br/>"._DB_USER." : ".$this->user."<br/>"._PASSWORD." : ".$this->pass;
+			if($this->databasetype == "POSTGRESQL")
+			{
+				echo "<br/>"._DATABASE.' : '.$this->base;
+			}
+			exit();
+		}
+
+		// Selection error
+		if($this->what_sql_error == 2)
+		{
+			echo "- <b>"._SELECTION_BASE_ERROR."</b> -<br /><br />"._DATABASE." : ".$this->base;
+			exit();
+		}
+
+		// Query error
+		if($this->what_sql_error == 3)
+		{
+			echo "- <b>"._QUERY_ERROR."</b> -<br /><br />";
+			if($this->databasetype == "MYSQL")
+			{
+				echo _ERROR_NUM.@mysqli_errno($this->sql_link)." "._HAS_JUST_OCCURED." :<br />";
+				echo _MESSAGE." : ". @mysqli_error($this->sql_link)."<br />";
+			}
+			elseif($this->databasetype == "POSTGRESQL")
+			{
+				@pg_send_query($this->sql_link, $this->debug_query);
+				$res = @pg_get_result($this->sql_link);
+				echo @pg_result_error($res);
+			}
+			elseif($this->databasetype == "SQLSERVER")
+			{
+				echo @mssql_get_last_message();
+			}
+			elseif($this->databasetype == "ORACLE")
+			{
+				$res = @oci_error($this->statement);
+				echo  $res['message'];
+			}
+			echo "<br/>"._QUERY." : <textarea cols=\"70\" rows=\"10\">".$this->debug_query."</textarea>";
+			exit();
+		}
+
+		// Closing connexion error
+		if($this->what_sql_error == 4)
+		{
+			echo "- <b>"._CLOSE_CONNEXION_ERROR."</b> -<br /><br />";
+			exit();
+		}
+
+		// Constructor error
+		if($this->what_sql_error == 5)
+		{
+			echo "- <b>"._DB_INIT_ERROR."</b> <br />";
+			exit();
+		}
+	}
+
+	/**
+	* Shows the query for debug
+	*
+	*/
+	public function show()
+	{
+		echo _LAST_QUERY." : <textarea cols=\"70\" rows=\"10\">".$this->debug_query."</textarea>";
+	}
+	
+	/**
+	* Returns the last insert id for the current query in case  of autoincrement id
+	*
+	* @return integer  last increment id
+	*/
+	public function last_insert_id()
+	{
+		if($this->databasetype == "MYSQL")
+		{
+			return @mysqli_insert_id($this->sql_link);
+		}
+		elseif($this->databasetype == "POSTGRESQL")
+		{
+
+		}
+		elseif($this->databasetype == "SQLSERVER")
+		{
+
+		}
+		elseif($this->databasetype == "ORACLE")
+		{
+
+		}
+		else
+		{
+
+		}
+		
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_docserver.php b/core/trunk/core/class/class_docserver.php
new file mode 100644
index 00000000000..26e265f0953
--- /dev/null
+++ b/core/trunk/core/class/class_docserver.php
@@ -0,0 +1,317 @@
+<?php 
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Manages docservers and  filenames in docservers directory
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Manages docservers and  filenames in docservers directory
+*
+*<ul>
+*  <li>Selection of available docserver</li>
+*  <li>Copy of a new file into the docserver</li>
+*  <li>Update of the docserver informations in the database</li>
+*</ul>
+* @ingroup core
+*/
+ class docserver extends dbquery
+ {
+ 	/**
+	* Docserver identifier
+         * String
+         */
+ 	private $docserver_id;
+
+	/**
+	* Readonly mode activated or not
+	* Boolean
+	*/
+ 	private $is_readonly;
+
+	/**
+	* Docserver enabled or not
+	* Boolean
+	*/
+ 	private $is_enabled;
+
+	/**
+	* Docserver size limit
+         * Integer
+         */
+ 	private $size_limit;
+
+	/**
+	* Actual size of the docserver
+         * Integer
+          */
+ 	private $actual_size;
+
+	/**
+	* Path of the docserver in the network or local
+         * String
+         */
+ 	private $path;
+
+	/**
+	* Creation date of the docserver
+	* Date
+	*/
+ 	private $creation_date;
+
+	/**
+	* Closing date of the docserver
+	* Date
+	*/
+ 	private $close_date;
+
+	/**
+	* Collection identifier
+	* String
+	*/
+	private $coll_id;
+
+	/**
+	* Error variable
+	* String
+	*/
+ 	private $error ;
+
+	/**
+	* Constructor  :  by default, the construct method chooses the first available docserver for a collection
+	*
+	* @param  $table  string Docserver table in the database
+	* @param  $coll_id  string Collection identifier
+	*/
+ 	function __construct($table, $coll_id)
+ 	{
+		parent::__construct();
+		$this->error = '';
+ 		$this->connect();
+ 		$this->query("select min(priority) as priority from ".$table." where is_readonly = 'N' and enabled = 'Y' and coll_id = '".$coll_id."'");
+ 		if($this->nb_result() == 0)
+		{
+			$this->error = _NO_AVAILABLE_DOCSERVER.". "._MORE_INFOS.".";
+		}
+		else
+		{
+			$res = $this->fetch_object();
+
+			$priority = $res->priority;
+			$this->query("select * from ".$table." where is_readonly = 'N' and enabled = 'Y' and coll_id = '".$coll_id."' and priority = ".$priority);
+
+			$res = $this->fetch_object();
+ 			$this->docserver_id = $res->docserver_id;
+ 			$this->is_readonly = $res->is_readonly;
+ 			$this->is_enabled = $res->is_enabled;
+ 			$this->size_limit = $res->size_limit;
+ 			$this->actual_size = $res->actual_size;
+ 			$this->path = $res->path_template;
+ 			$this->creation_date = $res->creation_date;
+ 			$this->close_date = $res->closing_date;
+			$this->coll_id = $res->coll_id;
+		}
+ 	}
+
+	/**
+	* Checks the size of the docserver plus a new file to see if there is enough disk space
+	*
+	* @param  $filesize integer File size
+	* @return integer New docserver size or 0 if not enough disk space available
+	*/
+ 	public function check_size($filesize)
+ 	{
+ 		$new_docserver_size = $this->actual_size + $filesize;
+ 		if($this->size_limit > 0 && $new_docserver_size >= $this->size_limit)
+		{
+			$this->error = _NOT_ENOUGH_DISK_SPACE.". "._MORE_INFOS.".";
+			return 0;
+		}
+		else
+		{
+			return $new_docserver_size;
+		}
+ 	}
+
+	/**
+	* Docserver error management
+	*
+	* @return string Error message
+	*/
+ 	public function get_error()
+ 	{
+ 		return $this->error;
+ 	}
+
+	/**
+	* Gets the identifier of the docserver object
+	*
+	* @return string Docserver Identifier
+	*/
+ 	public function get_id()
+ 	{
+ 		return $this->docserver_id;
+ 	}
+
+	/**
+	* Gets the path of the docserver object
+	*
+	* @return string Docserver path
+	*/
+ 	public function get_path()
+ 	{
+ 		return $this->path;
+ 	}
+
+	/**
+	* Calculates the next file name in the docserver
+	*
+	* @return array Contains 2 items : subdirectory path and new filename
+	*/
+	public function filename()
+	{
+		$path_template = $this->path;
+		//Scans the docserver path
+		$file_tab = scandir($path_template);
+		// Removes . and .. lines
+		array_shift($file_tab);
+		array_shift($file_tab);
+		$nb_files = count($file_tab);
+		// Docserver is empty
+		if ($nb_files == 0 )
+		{
+			// Creates the directory
+			if (!mkdir($path_template."1",0000700))
+			{
+				$this->error = _FILE_SEND_ERROR;
+				$_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+			}
+			else
+			{
+				$destination_rept = $path_template."1".DIRECTORY_SEPARATOR;
+				$file_destination_name = "1";
+				return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name);
+			}
+		}
+		//Docserver not empty
+		else
+		{
+			//Gets next usable subdirectory in the docserver
+			$destination_rept = $path_template.count($file_tab).DIRECTORY_SEPARATOR;
+			$file_tab2 = scandir($path_template.strval(count($file_tab)));
+			// Removes . and .. lines
+			array_shift($file_tab2);
+			array_shift($file_tab2);
+			$nb_files2 = count($file_tab2);
+			//If number of files => 2000 then creates a new subdirectory
+			if($nb_files2 >= 2000 )
+			{
+				$new_rept = ($nb_files) + 1;
+				if (!mkdir($path_template.$new_rept,0000700))
+				{
+					$this->error = _FILE_SEND_ERROR;
+					$_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+				}
+				else
+				{
+					$destination_rept = $path_template.$new_rept.DIRECTORY_SEPARATOR;
+					$file_destination_name = "1";
+					return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name);
+				}
+			}
+			// Docserver contains less than 2000 files
+			else
+			{
+				$new_file_name = ($nb_files2) + 1;
+				$greater = $new_file_name;
+				for($n=0;$n<count($file_tab2);$n++)
+				{
+					$current_file_name = array();
+					$current_file_name = explode(".",$file_tab2[$n]);
+					if((int)$greater  <= (int)$current_file_name[0])
+					{
+						if((int)$greater  == (int)$current_file_name[0])
+						{
+							$greater ++;
+						}
+						else // $greater < current
+						{
+							$greater = (int)$current_file_name[0] +1;
+						}
+					}
+				}
+				$file_destination_name = $greater ;
+				return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name);
+			}
+		}
+	}
+
+	/**
+	* Sets the size of the docserver
+	*
+	* @param  $new_size integer New size of the docserver
+	* @param $table string Docserver table in the database
+	*/
+	public function set_size($new_size, $table)
+	{
+		$this->connect();
+		$this->query("update ".$table." set actual_size=".$new_size." where docserver_id='".$this->docserver_id."'");
+		$this->actual_size = $new_size;
+	}
+
+	/**
+	* Selects a writable docserver
+	*
+	* @param  $id string Docserver identifier
+	* @param $table  string Docserver table in the database
+	*/
+	public function select_docserver($id, $table)
+ 	{
+ 		$this->connect();
+ 		$this->query("select * from ".$table." where docserver_id = '".$id."'");
+ 		$res = $this->fetch_object();
+ 		$this->docserver_id = $id;
+ 		$this->is_readonly = $res->is_readonly;
+ 		$this->is_enabled = $res->is_enabled;
+ 		$this->size_limit = $res->size_limit;
+ 		$this->actual_size = $res->actual_size;
+ 		$this->path = $res->path_template;
+ 		$this->creation_date = $res->creation_date;
+ 		$this->close_date = $res->closing_date;
+ 		$this->error = '';
+ 	}
+
+
+ 	/**
+	* Empties the docserver error variable
+	*
+	*/
+ 	public function init_error()
+ 	{
+ 		$this->error = '';
+	 }
+}
+?>
\ No newline at end of file
diff --git a/core/trunk/core/class/class_functions.php b/core/trunk/core/class/class_functions.php
new file mode 100644
index 00000000000..c3fb3526475
--- /dev/null
+++ b/core/trunk/core/class/class_functions.php
@@ -0,0 +1,1328 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the various functions of this application.
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the various functions of this application.
+*
+* <ul>
+*  <li>The toolkit of the Maarch framework</li>
+*  <li>Management of variables format</li>
+*  <li>Management of date format</li>
+* </ul>
+* @ingroup core
+*/
+class functions
+{
+	/**
+	*
+	* @deprecated
+         */
+	private $f_page;
+
+	/**
+	* To calculate the page generation time
+	* Integer
+         */
+	private $start_page;
+
+	/**
+	* Loads in the start_page variable the start time of the page loading
+	*
+	*/
+	public function start_page_stat()
+	{
+		$this->start_page = microtime(true);
+	}
+
+	/**
+	* Cuts a string at the maximum number of char to displayed
+	*
+	* @param	 $string string String value
+	* @param	 $max integer Maximum character number
+	*/
+	public function cut_string($string, $max)
+	{
+		if (strlen($string) >= $max)
+		{
+		  $string = substr($string, 0, $max);
+		  $espace = strrpos($string, " ");
+		  $string = substr($string, 0, $espace)."...";
+		  return $string;
+		}
+		else
+		{
+			return $string;
+		}
+	}
+
+	/**
+	* Ends the page loading time and displays it
+	*
+	*/
+	public function show_page_stat()
+	{
+		$end_page = microtime(true);
+		$page_total = round($end_page - $this->start_page,3);
+		if($page_total > 1)
+		{
+			$page_seconds = _SECONDS;
+		}
+		else
+		{
+			$page_seconds = _SECOND;
+		}
+		echo _PAGE_GENERATED_IN." <b>".$page_total."</b> ".$page_seconds;
+	}
+
+	/**
+	* Configures the actual position of the visitor with all query strings to go to the right page after the logging action
+	*
+	* @param	 $index string "index.php?" by default
+	*/
+	public function configPosition($index ="index.php?")
+	{
+		$querystring = $_SERVER['QUERY_STRING'];
+		$tab_query = explode("&",$querystring);
+		$querystring = "";
+
+		for($i=0;$i<count($tab_query);$i++)
+		{
+			if(substr($tab_query[$i],0,3) <> "css" && substr($tab_query[$i],0,3) <> "CSS")
+			{
+				$querystring .= $tab_query[$i]."&";
+			}
+		}
+		$querystring = substr($querystring,0,strlen($querystring)-1);
+		$_SESSION['position'] = $index.$querystring;
+	}
+
+	/**
+	* Adds en error to the errors log
+	*
+	* @param	 $msg  string Message to add
+	* @param  $var  string Language dependant message
+	*/
+	public function add_error($msg,$var)
+	{
+		$msg = trim($msg);
+		if(!empty($msg))
+		{
+			$_SESSION['error'] .= $msg." ".$var."<br />";
+			if(strlen(str_replace(array("<br />","<br />"),"",$_SESSION['error'])) < 6)
+			{
+				$_SESSION['error'] = "";
+			}
+		}
+	}
+
+	/**
+	* Cleans a variable with multiple possibility
+	*
+	* @param	 $what  string Variable to clean
+	* @param  $mask  string Mask, "no" by default
+	* @param	 $msg_error string Error message, empty by default
+	* @param	 $empty  string "yes" by default
+	* @param	 $min_limit integer Empty by default
+	* @param	 $max_limit integer Empty by default
+	* @return	string Cleaned variable or empty string
+	*/
+	public function wash($what, $mask = "no", $msg_error = "", $empty = "yes", $min_limit = "", $max_limit = "", $custom_pattern = '', $custom_error_msg = '')
+	{
+
+		//$w_var = addslashes(trim(strip_tags($what)));
+
+		$w_var = trim(strip_tags($what));
+		$test_empty = "ok";
+
+		if($empty == "yes")
+		{
+			// We use strlen instead of the php's empty function because for a var containing 0 return by a form (in string format)
+			// the empty function return that the var is empty but it contains à 0
+			if(strlen($w_var) == 0)
+			{
+				$test_empty = "no";
+			}
+			else
+			{
+				$test_empty = "ok";
+			}
+		}
+		if($test_empty == "no")
+		{
+			$this->add_error($msg_error, _IS_EMPTY);
+			return "";
+		}
+		else
+		{
+			if($msg_error <> '')
+			{
+				if($min_limit <> "")
+				{
+					if(strlen($w_var) < $min_limit)
+					{
+						if($min_limit > 1)
+						{
+							$this->add_error($msg_error,  _MUST_MAKE_AT_LEAST." ".$min_limit." "._CHARACTERS);
+						}
+						else
+						{
+							$this->add_error($msg_error, _MUST_MAKE_AT_LEAST." ".$min_limit." "._CHARACTERS);
+						}
+						return "";
+					}
+				}
+			}
+
+			if($max_limit <> "")
+			{
+				if(strlen($w_var) > $max_limit)
+				{
+					if($min_limit > 1)
+					{
+						$this->add_error($msg_error, MUST_BE_LESS_THAN." ".$max_limit." "._CHARACTERS);
+					}
+					else
+					{
+						$this->add_error($msg_error,  MUST_BE_LESS_THAN." ".$max_limit." "._CHARACTERS);
+					}
+
+					return "";
+				}
+			}
+
+			switch ($mask)
+			{
+				case "no":
+					return $w_var;
+
+				case "num":
+					if (preg_match("/^[0-9]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT." :<br/>"._WAITING_INTEGER);
+						return "";
+					}
+
+				case "float":
+					if (preg_match("/^[0-9.,]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT." "._WAITING_FLOAT);
+						return "";
+					}
+
+				case "letter":
+					if (preg_match("/^[a-zA-Z]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT);
+						return "";
+					}
+
+				case "alphanum":
+					if (preg_match("/^[a-zA-Z0-9]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error,_WRONG_FORMAT);
+						return "";
+					}
+
+				case "nick":
+					if (preg_match("/^[_a-zA-Z0-9.-]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error,_WRONG_FORMAT);
+						return "";
+					}
+
+				case "mail":
+					if (preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT);
+						return "";
+					}
+
+				case "url":
+					if (preg_match("/^[www.]+[_a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT);
+						return "";
+					}
+
+				case "file":
+					if (preg_match("/^[_a-zA-Z0-9.-? é&\/]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT);
+						return "";
+					}
+
+				case "name":
+					if (preg_match("/^[_a-zA-Z0-9.-? \'\/&éea]+$/",$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT);
+						return "";
+					}
+				case "date":
+					if($_SESSION['config']['databasetype'] == "SQLSERVER")
+					{
+						$date_pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
+					}
+					else // MYSQL & POSTGRESQL
+					{
+						$date_pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
+					}
+					if(preg_match($date_pattern,$w_var))
+					{
+						return $w_var;
+					}
+					else
+					{
+						$this->add_error($msg_error, _WRONG_FORMAT." "._WAITING_DATE);
+						return "";
+					}
+				case "custom":
+					if(preg_match($custom_pattern,$w_var) == 0)
+					{
+						$this->add_error($msg_error, $custom_error_msg.' '.$custom_pattern.' '.$w_var);
+						return "";
+					}
+					else
+					{
+						return $w_var;
+					}
+			}
+		}
+	}
+
+	/**
+	* Returns a variable with personnal formating. It allows you to add formating action when you displays the variable the var
+	*
+	* @param	 $what string Variable to format
+	* @return string  Formated variable
+	*/
+	public function show($what)
+	{
+		return stripslashes($what);
+	}
+
+	/**
+	* Manages the location bar in session (4 levels max), then calls the where_am_i() function.
+	*
+	* @param	 $path  string Url (empty by default)
+	* @param   $label string Label to show in the location bar (empty by default)
+	* @param   $id_pagestring  Page identifier (empty by default)
+	* @param   $init bool If true reinits the location bar (true by default)
+	* @param   $level string Level in the location bar (empty by default)
+	*/
+	public function manage_location_bar($path = '', $label = '', $id_page = '', $init = true, $level = '')
+	{
+		//Fix un little php bug
+		if(strpos($label,"&rsquo;")!== false)
+		{
+			$label = str_replace("&rsquo;" , "\'", $label);
+		}
+
+		$_SESSION['location_bar']['level1']['path'] = "index.php?reinit=true";
+		$_SESSION['location_bar']['level1']['label'] = $_SESSION['config']['applicationname'];
+		$_SESSION['location_bar']['level1']['id'] = "welcome";
+
+		if(!empty($level))
+		{
+			if($level == 1)
+			{
+				$_SESSION['location_bar']['level2']['path']	= "";
+				$_SESSION['location_bar']['level2']['label'] = "";
+				$_SESSION['location_bar']['level2']['id'] = "" ;
+
+				$_SESSION['location_bar']['level3']['path'] = "";
+				$_SESSION['location_bar']['level3']['label'] = "";
+				$_SESSION['location_bar']['level3']['id'] = "" ;
+
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			elseif($level == 2)
+			{
+				$_SESSION['location_bar']['level3']['path'] = "";
+				$_SESSION['location_bar']['level3']['label'] = "";
+				$_SESSION['location_bar']['level3']['id'] = "" ;
+
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			elseif($level == 3)
+			{
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+		}
+		else
+		{
+
+			if(trim($id_page) == trim($_SESSION['location_bar']['level1']['id']))
+			{
+				$_SESSION['location_bar']['level2']['path']	= "";
+				$_SESSION['location_bar']['level2']['label'] = "";
+				$_SESSION['location_bar']['level2']['id'] = "" ;
+
+				$_SESSION['location_bar']['level3']['path'] = "";
+				$_SESSION['location_bar']['level3']['label'] = "";
+				$_SESSION['location_bar']['level3']['id'] = "" ;
+
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			elseif(trim($id_page) == trim($_SESSION['location_bar']['level2']['id']))
+			{
+				$_SESSION['location_bar']['level3']['path'] = "";
+				$_SESSION['location_bar']['level3']['label'] = "";
+				$_SESSION['location_bar']['level3']['id'] = "" ;
+
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			elseif(trim($id_page) == trim($_SESSION['location_bar']['level3']['id']))
+			{
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			elseif($init || empty($_SESSION['location_bar']['level2']['id']))
+			{
+				$_SESSION['location_bar']['level2']['path']	= $path;
+				$_SESSION['location_bar']['level2']['path'] .= "&level=2";
+				$_SESSION['location_bar']['level2']['label'] = $this->wash_html($label);
+				$_SESSION['location_bar']['level2']['id'] = $id_page ;
+
+				$_SESSION['location_bar']['level3']['path'] = "";
+				$_SESSION['location_bar']['level3']['label'] = "";
+				$_SESSION['location_bar']['level3']['id'] = "" ;
+
+				$_SESSION['location_bar']['level4']['path'] = "";
+				$_SESSION['location_bar']['level4']['label'] = "";
+				$_SESSION['location_bar']['level4']['id'] = "" ;
+			}
+			else
+			{
+				if(empty($_SESSION['location_bar']['level3']['path']))
+				{
+					$_SESSION['location_bar']['level3']['path']	= $path."&level=3";
+					$_SESSION['location_bar']['level3']['label'] = $this->wash_html($label);
+					$_SESSION['location_bar']['level3']['id'] = $id_page ;
+
+					$_SESSION['location_bar']['level4']['path'] = "";
+					$_SESSION['location_bar']['level4']['label'] = "";
+					$_SESSION['location_bar']['level4']['id'] = "" ;
+				}
+				else
+				{
+					$_SESSION['location_bar']['level4']['path']	= $path."&level=4";
+					$_SESSION['location_bar']['level4']['label'] = $this->wash_html($label);
+					$_SESSION['location_bar']['level4']['id'] = $id_page ;
+				}
+			}
+		}
+		$this->where_am_i();
+	}
+
+	/**
+	* Uses javascript to rewrite the location bar
+	*
+	*/
+	private function where_am_i()
+	{
+		if(empty($_SESSION['location_bar']['level2']['path']))
+		{
+		?><script language="javascript" type="text/javascript">
+        	var bar = window.document.getElementById('ariane');
+			if(bar != null)
+			{
+				var link1 = document.createElement("a");
+				link1.href='<?php  echo $_SESSION['location_bar']['level1']['path'];?>';
+				var label1 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level1']['label'];?>");
+				link1.appendChild(label1);
+				bar.appendChild(link1);
+			}
+        </script><?php
+		}
+		else
+		{
+			if(empty($_SESSION['location_bar']['level3']['path']))
+			{
+				?><script language="javascript" type="text/javascript">
+					var bar = window.document.getElementById('ariane');
+					if(bar != null)
+					{
+						var link1 = document.createElement("a");
+						link1.href='<?php  echo $_SESSION['location_bar']['level1']['path'];?>';
+						var label1 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level1']['label'];?>");
+						link1.appendChild(label1);
+						bar.appendChild(link1);
+						var text1 = document.createTextNode(" > <?php  echo $_SESSION['location_bar']['level2']['label'];?>");
+						bar.appendChild(text1);
+					}
+				</script><?php
+			}
+			else
+			{
+				if(empty($_SESSION['location_bar']['level4']['path']))
+				{
+					?><script language="javascript" type="text/javascript">
+			        	var bar = window.document.getElementById('ariane');
+						if(bar != null)
+						{
+							var link1 = document.createElement("a");
+							link1.href='<?php  echo $_SESSION['location_bar']['level1']['path'];?>';
+							var label1 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level1']['label'];?>");
+							link1.appendChild(label1);
+							bar.appendChild(link1);
+							var text1 = document.createTextNode(" > ");
+							bar.appendChild(text1);
+							var link2 = document.createElement("a");
+							link2.href='<?php  echo $_SESSION['location_bar']['level2']['path'];?>';
+							var label2 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level2']['label'];?>");
+							link2.appendChild(label2);
+							bar.appendChild(link2);
+							var text2 = document.createTextNode(" > <?php  echo $_SESSION['location_bar']['level3']['label'];?>");
+							bar.appendChild(text2);
+						}
+					</script><?php
+				}
+				else
+				{
+					?><script language="javascript" type="text/javascript">
+			        	var bar = window.document.getElementById('ariane');
+						if(bar != null)
+						{
+							var link1 = document.createElement("a");
+							link1.href='<?php  echo $_SESSION['location_bar']['level1']['path'];?>';
+							var label1 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level1']['label'];?>");
+							link1.appendChild(label1);
+							bar.appendChild(link1);
+							var text1 = document.createTextNode(" > ");
+							bar.appendChild(text1);
+							var link2 = document.createElement("a");
+							link2.href='<?php  echo $_SESSION['location_bar']['level2']['path'];?>';
+							var label2 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level2']['label'];?>");
+							link2.appendChild(label2);
+							bar.appendChild(link2);
+							var text2 = document.createTextNode(" > ");
+							bar.appendChild(text2);
+							var link3 = document.createElement("a");
+							link3.href='<?php  echo $_SESSION['location_bar']['level3']['path'];?>';
+							var label3 = document.createTextNode("<?php  echo $_SESSION['location_bar']['level3']['label'];?>");
+							link3.appendChild(label3);
+							bar.appendChild(link3);
+							var text3 = document.createTextNode(" > <?php  echo $_SESSION['location_bar']['level4']['label'];?>");
+							bar.appendChild(text3);
+						}
+					</script><?php
+				}
+			}
+		}
+	}
+
+	/**
+	* For debug, displays an array in a more readable way
+	*
+	* @param   $arr array Array to display
+	*/
+	public function show_array($arr)
+	{
+		echo "<table width=\"550\"><tr><td align=\"left\">";
+		echo "<pre>";
+		print_r($arr);
+		echo "</pre>";
+		echo "</td></tr></table>";
+	}
+
+	/**
+	* Formats a datetime to a dd/mm/yyyy format (date)
+	*
+	* @param   $date datetime The date to format
+	* @return	datetime  The formated date
+	*/
+	public function format_date($date)
+	{
+		$last_date = '';
+		if($date <> "")
+		{
+			if(strpos($date," "))
+			{
+				$date_ex = explode(" ",$date);
+				$the_date = explode("-",$date_ex[0]);
+				$last_date = $the_date[2]."-".$the_date[1]."-".$the_date[0];
+			}
+			else
+			{
+				$the_date = explode("-",$date);
+				$last_date = $the_date[2]."-".$the_date[1]."-".$the_date[0];
+			}
+		}
+		return $last_date;
+	}
+
+	/**
+	* Formats a datetime to a dd/mm/yyyy hh:ii:ss format (timestamp)
+	*
+	* @param   $date  datetime The date to format
+	* @return	datetime  The formatted date
+	*/
+	public function dateformat($date, $sep = '/')
+	{
+		if($date <> "")
+		{
+			$ar_test = explode(" ",$date);
+			$date = $ar_test[0];
+			$time = $ar_test[1];
+			if(preg_match('/\./',$time))
+			{
+				$tmp = explode('.', $time);
+				$time = $tmp[0];
+			}
+			$ar_date = explode("-",$date);
+			if(substr($ar_test[1],0,2) == "00")
+			{
+				return $ar_date[2].$sep.$ar_date[1].$sep.$ar_date[0];
+			}
+			else
+			{
+				return $ar_date[2].$sep.$ar_date[1].$sep.$ar_date[0]." ".$time;
+			}
+		}
+	}
+
+	/**
+	* Writes an error in pre formating format with header and footer
+	*
+	* @param   $title string Error title
+	* @param	  $message  string Error message
+	* @param	  $type string If 'title' then displays the title otherwise do not displays it (empty by default)
+	* @param	  $img_src string Source of the image to show (empty by default)
+	*/
+	public function echo_error($title,$message, $type = '', $img_src = '')
+	{
+		if ($type == 'title' || $type <> '')
+		{
+			if($img_src <> '')
+			{
+				echo '<h1><img src="'.$img_src.'" alt="" />'.$title.'</h1>';
+			}
+			else
+			{
+				echo "<h1>".$title."</h1>";
+			}
+			echo '<div id="inner_content">';
+        } ?>
+		<p>&nbsp;</p>
+		<p>&nbsp;</p>
+		<p>&nbsp;</p>
+		<p>&nbsp;</p>
+		<p>&nbsp;</p>
+		<p>&nbsp;</p>
+		<?php echo $message;
+		if ($type <> '')
+		{
+        	echo '</div>';
+        }
+	}
+
+	/**
+	* Checks a date and writes the error in session if any
+	*
+	* @param   $day string Day
+	* @param	  $month string Month
+	* @param	  $year string Year
+	*/
+	public function verif_date($day,$month,$year)
+	{
+		if($month > 12)
+		{
+			$_SESSION['error'] .= _BAD_MONTH_FORMAT.".<br />";
+			$_SESSION['monthstart'] = "";
+		}
+		if($day > 31)
+		{
+			$_SESSION['error'] .= _BAD_DAY_FORMAT.".<br />";
+			$_SESSION['daystart'] = "";
+		}
+		else
+		{
+			if($month == "2" || $month == "02")
+			{
+				if($day > 29)
+				{
+					$_SESSION['error'] .= _BAD_FEBRUARY.".<br />";
+					$_SESSION['daystart'] = "";
+				}
+			}
+			else
+			{
+				if($month == 2 || $month == 4 || $month == 6 || $month == 9 || $month == 11)
+				{
+					if($day > 30)
+					{
+						$_SESSION['error'] .= _BAD_DAY_FORMAT."t.<br />";
+						$_SESSION['daystart'] = "";
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	*  Displays a variable with a label if the var is not empty
+	*
+	* @param   $what string The variable to display
+	* @param	  $label string The label
+	*/
+	public function writeifnotempty($what,$label)
+	{
+		if(!empty($what))
+		{
+			echo "<span class=\"title\">".$label."</span> : ".$what."<br />";
+		}
+	}
+
+	/**
+	*  Extracts the user informations from database and puts the result in an array
+	*
+	* @param  $id integer User identifier
+	*/
+	public function infouser($id)
+	{
+		$conn = new dbquery();
+		$conn->connect();
+
+		$conn->query("select * from ".$_SESSION['tablename']['users']." where user_id = '".$id."'");
+		if($conn->nb_result() == 0)
+		{
+			return array("UserId" => "",
+							"FirstName" => "",
+							"LastName" => "",
+							"Phone" => "",
+							"Mail" => "",
+							"department" => ""
+						);
+		}
+		else
+		{
+			$line = $conn->fetch_object();
+			return array("UserId" => $line->user_id,
+							"FirstName" => $this->show_string($line->firstname),
+							"LastName" => $this->show_string($line->lastname),
+							"Phone" => $line->phone,
+							"Mail" => $line->mail ,
+							"department" => $this->show_string($line->department)
+						);
+		}
+	}
+
+
+	/**
+	* Tests the exitence of a remote file
+	*
+	* @param  $url string Url to connect
+	* @return 1 if the URL  host is empty, 2 if Unable to connect to remote host, true if the file exists and false otherwise
+	*/
+	function remote_file_exists ($url)
+	{
+		$head = "";
+	    $url_p = parse_url($url);
+	    if (isset ($url_p["host"]))
+	    {
+	    	$host = $url_p["host"];
+	   	}
+	    else
+	    {
+	    	return 1;
+	    }
+	    if (isset ($url_p["path"]))
+	    {
+	    	$path = $url_p["path"];
+	    }
+	    else
+	    {
+	    	$path = "";
+	    }
+	    $fp = fsockopen ($host, 80, $errno, $errstr, 20);
+	    if (!$fp)
+	    {
+	    	return 2;
+	    }
+	    else
+	    {
+	        $parse = parse_url($url);
+	        $host = $parse['host'];
+
+	        fputs($fp, "HEAD ".$url." HTTP/1.1\r\n" );
+	        fputs($fp, "HOST: ".$host."\r\n" );
+	        fputs($fp, "Connection: close\r\n\r\n" );
+	        $headers = "";
+	        while (!feof ($fp))
+	        {
+	        	$headers .= fgets ($fp, 128);
+	        }
+	    }
+	    fclose ($fp);
+	    $arr_headers = explode("\n", $headers);
+	    $return = false;
+	    if (isset ($arr_headers[0]))
+	    {
+	    	$return = strpos ($arr_headers[0], "404" ) === false;
+	    }
+	    return $return;
+	 }
+
+	/**
+	* Returns a formated date for SQL queries
+	*
+	* @param  $date date Date to format
+	* @param  $insert bool If true format the date to insert in the database (true by default)
+	* @return Formated date or empty string if any error
+	*/
+	function format_date_db($date, $insert=true)
+	{
+		if ($date <> "" )
+		{
+			$var=explode("-",$date) ;
+			if(preg_match('/^[0-3][0-9]$/', $var[0]))
+			{
+				$jour = $var[0];
+				$mois= $var[1];
+				$annee =  $var[2];
+			}
+			else
+			{
+				$annee = $var[0];
+				$mois= $var[1];
+				$jour =  substr($var[2], 0,2);
+			}
+			if ($annee <= "1900")
+			{
+				return '';
+			}
+			else
+			{
+				if($_SESSION['config']['databasetype'] == "SQLSERVER")
+				{
+					return  $jour."-".$mois."-".$annee;
+				}
+				elseif($_SESSION['config']['databasetype'] == "POSTGRESQL")
+				{
+					if($_SESSION['config']['lang'] == "fr")
+					{
+						return $jour."-".$mois."-".$annee;
+					}
+					else
+					{
+						return $annee."-".$mois."-".$jour;
+					}
+				}
+				elseif($_SESSION['config']['databasetype'] == "ORACLE")
+				{
+
+					return  $jour."-".$mois."-".$annee;
+				}
+				elseif($_SESSION['config']['databasetype'] == "MYSQL" && $insert)
+				{
+					return $annee."-".$mois."-".$jour;
+				}
+				elseif($_SESSION['config']['databasetype'] == "MYSQL" && !$insert)
+				{
+					return  $jour."-".$mois."-".$annee;
+				}
+			}
+		}
+		else
+		{
+			return '';
+		}
+	}
+
+	/**
+	* Protects string to insert in the database
+	*
+	* @param  $string string String to format
+	* @return Formated date
+	*/
+	public function protect_string_db($string)
+	{
+		if($_SESSION['config']['databasetype'] == "SQLSERVER")
+		{
+			$string = str_replace("'", "''", $string);
+			$string = str_replace("\\", "", $string);
+		}
+		else if($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+			$string = str_replace("'", "''", $string);
+			$string = str_replace("\\", "", $string);
+		}
+		else if($_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL" && (ini_get('magic_quotes_gpc') <> true || phpversion() >= 6))
+		{
+			$string = addslashes($string);
+		}
+
+		return $string;
+	}
+
+	/**
+	* Returns a string without the escaping characters
+	*
+	* @param  $string string String to format
+	* @return Formated string
+	*/
+	public function show_string($string, $replace_CR = false, $chars_to_escape = array())
+	{
+		if($_SESSION['config']['databasetype'] == "SQLSERVER")
+		{
+			$string = str_replace("''", "'", $string);
+			$string = str_replace("\\", "", $string);
+		}
+		else if($_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL" && (ini_get('magic_quotes_gpc') <> true || phpversion() >= 6))
+		{
+			$string = stripslashes($string);
+			$string = str_replace("\\'", "'", $string);
+			$string = str_replace('\\"', '"', $string);
+		}
+		else if($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+			$string = str_replace("''", "'", $string);
+			$string = str_replace("\\", "", $string);
+		}
+		if($replace_CR)
+		{
+			$to_del = array("\t", "\n", "&#0A;", "&#0D;", "\r");
+			$string = str_replace($to_del, ' ', $string);
+		}
+		for($i=0;$i<count($chars_to_escape);$i++)
+		{
+			$string = str_replace($chars_toescape[$i], '\\'.$chars_to_escape, $string);
+		}
+		$string = str_replace('"', "'", $string);
+		return trim($string);
+	}
+
+	public function escape_string($string, $chars_to_escape=array())
+	{
+		for($i=0;$i<count($chars_to_escape);$i++)
+		{
+			$string = str_replace($chars_toescape[$i], '\\'.$chars_to_escape, $string);
+		}
+		return trim($string);
+	}
+
+	/**
+	* Retrieves  a constant value in a language file
+	*
+	* @param  $constant string Constant
+	* @param  $file string Path to the language file
+	* @return Displays an error message if the language file do not exists, returns the value of the constant or false otherwise
+	*/
+	public function retrieve_constant_lang($constant, $file)
+	{
+		$filelang = fopen($file, "r");
+		if(!file_exists($file))
+		{
+			echo '<div class="error">Language file missing: '.$file.'</div>';
+			exit();
+		}
+		$find = false;
+		while (!feof($filelang))
+		{
+
+			$string = fgets($filelang);
+			$search="`'".$constant."'`";
+			preg_match($search,$string,$out);
+			$count=count($out[0]);
+			if($count == 1)
+			{
+				$tab_string = explode("'", $string);
+				$myresult = $tab_string[3];
+				$find = true;
+				break;
+			}
+		}
+		if(!$find)
+		{
+			return false;
+		}
+		else
+		{
+			if(!empty($myresult))
+			{
+				return $myresult;
+			}
+			else
+			{
+				return false;
+			}
+		}
+	}
+
+	/**
+	* Cleans html string, replacing entities by utf-8 code
+	*
+	* @param  $var string  String to clean
+	* @return Cleaned string
+	*/
+	public function wash_html($var, $mode="UNICODE")
+	{
+		if($mode == "UNICODE")
+		{
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("<br />","\\n",$var);
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("&nbsp;"," ",$var);
+			$var = str_replace("&eacute;", "\u00e9",$var);
+			$var = str_replace("&egrave;","\u00e8",$var);
+			$var = str_replace("&ecirc;","\00ea",$var);
+			$var = str_replace("&agrave;","\u00e0",$var);
+			$var = str_replace("&acirc;","\u00e2",$var);
+			$var = str_replace("&icirc;","\u00ee",$var);
+			$var = str_replace("&ocirc;","\u00f4",$var);
+			$var = str_replace("&ucirc;","\u00fb",$var);
+			$var = str_replace("&acute;","\u0027",$var);
+			$var = str_replace("&deg;","\u00b0",$var);
+		}
+		else if($mode == 'NO_ACCENT')
+		{
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("<br />","\\n",$var);
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("&nbsp;"," ",$var);
+			$var = str_replace("&eacute;", "e",$var);
+			$var = str_replace("&egrave;","e",$var);
+			$var = str_replace("&ecirc;","e",$var);
+			$var = str_replace("&agrave;","a",$var);
+			$var = str_replace("&acirc;","â",$var);
+			$var = str_replace("&icirc;","i",$var);
+			$var = str_replace("&ocirc;","o",$var);
+			$var = str_replace("&ucirc;","u",$var);
+			$var = str_replace("&acute;","",$var);
+			$var = str_replace("&deg;","°",$var);
+		}
+		else
+		{
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("<br />","\\n",$var);
+			$var = str_replace("<br/>","\\n",$var);
+			$var = str_replace("&nbsp;"," ",$var);
+			$var = str_replace("&eacute;", "é",$var);
+			$var = str_replace("&egrave;","è",$var);
+			$var = str_replace("&ecirc;","ê",$var);
+			$var = str_replace("&agrave;","à",$var);
+			$var = str_replace("&acirc;","â",$var);
+			$var = str_replace("&icirc;","î",$var);
+			$var = str_replace("&ocirc;","ô",$var);
+			$var = str_replace("&ucirc;","û",$var);
+			$var = str_replace("&acute;","",$var);
+			$var = str_replace("&deg;","°",$var);
+		}
+		return $var;
+	}
+
+	/**
+	*  Returns the next Easter date
+	*
+	* @param  $year date (null by default)
+	* @return date The next easter date
+	*/
+	public function WhenEasterCelebrates($year = null)
+	{
+		if (is_null($year))
+		{
+			$year = (int)date ('Y');
+		}
+		$iN = $year - 1900;
+		$iA = $iN%19;
+		$iB = floor (((7*$iA)+1)/19);
+		$iC = ((11*$iA)-$iB+4)%29;
+		$iD = floor ($iN/4);
+		$iE = ($iN-$iC+$iD+31)%7;
+		$time = 25-$iC-$iE;
+		if($time > 0)
+		{
+			$WhenEasterCelebrates = strtotime ($year.'/04/'.$time);
+		}
+		else
+		{
+			$WhenEasterCelebrates = strtotime ($year.'/03/'.(31+$time));
+		}
+		return $WhenEasterCelebrates;
+	}
+
+	/**
+	*  Returns the next open day
+	*
+	* @param  $Date date
+	* @param  $Delta integer
+	* @return date The next open day
+	*/
+	public function WhenOpenDay($Date, $Delta)
+	{
+		$Date = strtotime ($Date);
+		$Hollidays = array (
+		'1_1',
+		'1_5',
+		'8_5',
+		'14_7',
+		'15_8',
+		'1_11',
+		'11_11',
+		'25_12'
+		);
+		if(function_exists ('easter_date'))
+		{
+			$WhenEasterCelebrates = easter_date ((int)date('Y'), $Date);
+		}
+		else
+		{
+			$WhenEasterCelebrates = getEaster ((int)date('Y'), $Date);
+		}
+		$Hollidays[] = date ('j_n', $WhenEasterCelebrates);
+		$Hollidays[] = date ('j_n', $WhenEasterCelebrates + (86400*39));
+		$Hollidays[] = date ('j_n', $WhenEasterCelebrates + (86400*49));
+		$iEnd = $Delta * 86400;
+		$i = 0;
+		while ($i < $iEnd)
+		{
+			$i = strtotime ('+1 day', $i);
+			if (in_array (date ('w', $Date+$i),array (0,6) ) || in_array (date ('j_n', $Date+$i), $Hollidays))
+			{
+				$iEnd = strtotime ('+1 day', $iEnd);
+				$Delta ++;
+			}
+		}
+		return date('d/m/Y', $Date + (86400*$Delta));
+	}
+
+	/**
+	*  Adds an interval to a date
+	*
+	* @param  $Date date Date
+	* @param  $num integer Interval
+	* @return date The date + the interval
+	*/
+	public function addDate($Date1, $num)
+	{
+		$Date1 = strtotime($Date1);
+		$result = date ('d-m-Y', $Date1 + (86400*$num));
+		return $result;
+	}
+
+	/**
+	*  Substracts an interval to a date
+	*
+	* @param  $Date date Date
+	* @param  $num integer Interval
+	* @return date The date - the interval
+	*/
+	public function removeDate($Date1, $num)
+	{
+		$Date1 = strtotime($Date1);
+		$result = date ('d-m-Y', $Date1 - (86400*$num));
+		return $result;
+	}
+
+	/**
+	*  Returns the next process day (Open day) after a given interval
+	*
+	* @param  $delay integer Interval
+	* @return date The next process day
+	*/
+	public function date_max_treatment($delay)
+	{
+		$result = $this->addDate(strftime("%Y")."-".strftime("%m")."-".strftime("%d"), $delay);
+		$result = $this->WhenOpenDay($result, 1);
+		return $result;
+	}
+
+	/**
+	* Formats a datetime to a mm/dd/yyyy hh:ii:ss format (timestamp)
+	*
+	* @param   $date datetime The date to format
+	* @return	datetime  The formated date
+	*/
+	public function dateformaten($date)
+	{
+		$ar_test = explode(" ",$date);
+
+		$date = $ar_test[0];
+		$time = $ar_test[1];
+		$ar_date = explode("/",$date);
+		if(preg_match('/\./',$time))
+		{
+			$tmp = explode('.', $time);
+			$time = $tmp[0];
+		}
+		if(substr($ar_test[1],0,2) == "00")
+		{
+			return $ar_date[1]."/".$ar_date[0]."/".$ar_date[2];
+		}
+		else
+		{
+			return $ar_date[1]."/".$ar_date[0]."/".$ar_date[2]." ".$time;
+		}
+	}
+
+	/**
+	* Converts a value (from the php.ini) into bytes
+	*
+	* @param   $val string Value to convert
+	* @return	integer The converted value
+	*/
+	public function return_bytes($val)
+	{
+		$val = trim($val);
+		$last = strtolower($val{strlen($val)-1});
+		switch($last) {
+			// 'G' modifier available since PHP 5.1.0
+			case 'g':
+				$val *= 1024;
+			case 'm':
+				$val *= 1024;
+			case 'k':
+				$val *= 1024;
+		}
+		return $val;
+	}
+
+	/**
+	*  Compares to date
+	*
+	* @param  $date1 date First date
+	* @param  $date2 date Second date
+	* @return "date1" if the first date is the greater, "date2" if the second date or "equal" otherwise
+	*/
+	public function compare_date($date1, $date2)
+	{
+		$date1 = strtotime($date1);
+		$date2 = strtotime($date2);
+		if($date1 > $date2)
+		{
+			$result = "date1";
+		}
+		elseif($date1 < $date2)
+		{
+			$result = "date2";
+		}
+		elseif($date1 = $date2)
+		{
+			$result = "equal";
+		}
+		return $result;
+	}
+
+	/**
+	*  Compares to date and return dif between 2 dates
+	*
+	* @param  $date1 date First date
+	* @param  $date2 date Second date
+	* @return dif between 2 dates in days
+	*/
+	public function nbDaysBetween2Dates($date1, $date2)
+	{
+		$date1 = strtotime($date1);
+		$date2 = strtotime($date2);
+		if($date2 > $date1)
+		{
+			$result = round((($date2 - $date1) / (3600)) / 24, 0);
+		}
+		elseif($date2 < $date1)
+		{
+			$result = round((($date1 - $date2) / (3600)) / 24, 0);
+		}
+		else
+		{
+			$result = 0;
+		}
+		return $result;
+	}
+
+	/**
+	*  Checks if a directory is empty
+	*
+	* @param  $dir string The directory to check
+	* @return bool True if empty, False otherwise
+	*/
+	function isDirEmpty($dir)
+	{
+		$dir = opendir($dir);
+		$isEmpty = true;
+		while(($entry = readdir($dir)) !== false)
+		{
+			if($entry !== '.' && $entry !== '..')
+			{
+				$isEmpty = false;
+				break;
+			}
+		}
+		closedir($dir);
+		return $isEmpty;
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_history.php b/core/trunk/core/class/class_history.php
new file mode 100644
index 00000000000..f912f6c9b7d
--- /dev/null
+++ b/core/trunk/core/class/class_history.php
@@ -0,0 +1,98 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the function to manage the history table
+*
+*<ul>
+* <li>Connexion logs and events history management</li>
+*</ul>
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the function to manage the history table
+*
+* @ingroup core
+*/
+class history extends dbquery
+{
+	/**
+	* Inserts a record in the history table
+	*
+	* @param  $where  string Table or view of the event
+	* @param  $id integer Identifier of the event to add
+	* @param  $how string Event type (Keyword)
+	* @param  $what string Event description
+	* @param  $databasetype string Type of the database (MYSQL, POSTGRESQL, etc...)
+	* @param  $id_module string Identifier of the module concerned by the event (admin by default)
+	*/
+	public function add($where,$id,$how,$what, $databasetype, $id_module ="admin")
+	{
+		if($databasetype == "SQLSERVER")
+		{
+			$date_now = "getdate()";
+		}
+		else if($databasetype == "MYSQL" || $databasetype == "POSTGRESQL" )
+		{ 
+			$date_now = "now()";
+		}
+		elseif($databasetype == "ORACLE")
+		{
+			$date_now = "SYSDATE";
+		}
+		$remote_ip = $_SERVER['REMOTE_ADDR'];
+		$what = $this->protect_string_db($what, $databasetype);
+	//	$what = $this->protect_string_db($what);
+		$this->connect();
+		$this->query("INSERT INTO ".$_SESSION['tablename']['history']." (table_name, record_id , event_type , user_id , event_date , info , id_module, remote_ip) VALUES ('".$where."', '".$id."', '".$how."', '".$_SESSION['user']['UserId']."', ".$date_now.", '".$what."', '".$id_module."' , '".$remote_ip."')");
+		$this->close_conn();
+	}
+	
+	/**
+	* Gets the label of an history keyword
+	*
+	* @param  $id  string Key word identifier
+	* @return  string Label of the key word or empty string
+	*/
+	public function get_label_history_keyword($id)
+	{
+		if(empty($id))
+		{
+			return '';
+		}
+		else
+		{
+			for($i=0; $i<count($_SESSION['history_keywords']);$i++)
+			{
+				if($id == $_SESSION['history_keywords'][$i]['id'])
+				{
+					return $_SESSION['history_keywords'][$i]['label'];
+				}
+			}
+		}
+		return '';
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_manage_status.php b/core/trunk/core/class/class_manage_status.php
new file mode 100644
index 00000000000..fe3e19dd3d6
--- /dev/null
+++ b/core/trunk/core/class/class_manage_status.php
@@ -0,0 +1,98 @@
+<?php
+/**
+* Core class for status
+*
+*  Contains all the functions to manage status
+*
+* @package  maarch
+* @version 3.0
+* @since 10/2005
+* @license GPL v3
+* @author  Claire Figueras  <dev@maarch.org>
+*
+*/
+
+class manage_status extends dbquery
+{
+	function __construct()
+	{
+		parent::__construct();
+	}
+
+	public function get_searchable_status()
+	{
+		$status = array();
+		$this->connect();
+		$this->query("select id, label_status from ".$_SESSION['tablename']['status']." where can_be_searched = 'Y'");
+		while($res = $this->fetch_object())
+		{
+			array_push($status, array('ID' => $res->id, 'LABEL' => $res->label_status));
+		}
+		return $status;
+	}
+
+	public function get_not_searchable_status()
+	{
+		$status = array();
+		$this->connect();
+		$this->query("select id, label_status from ".$_SESSION['tablename']['status']." where can_be_searched = 'N'");
+		while($res = $this->fetch_object())
+		{
+			array_push($status, array('ID' => $res->id, 'LABEL' => $res->label_status));
+		}
+		return $status;
+	}
+
+	public function get_status_data($id_status,$extension = '')
+	{
+		$this->connect();
+		$this->query("select label_status, maarch_module, img_filename from ".$_SESSION['tablename']['status']." where id = '".$id_status."'");
+		$res = $this->fetch_object();
+		$status_txt = $this->show_string($res->label_status);
+		$maarch_module = $res->maarch_module;
+		$img_name = $res->img_filename;
+		if(!empty($img_name))
+		{
+			$temp_explode = explode( ".", $img_name);
+			$temp_explode[0] = $temp_explode[0].$extension;
+			$img_name = implode(".", $temp_explode);
+		}
+		
+
+		if($maarch_module == 'apps' && isset($img_name) && !empty($img_name))
+		{
+			$img_path = $_SESSION['config']['businessappurl'].'img/'.$img_name;
+		}
+		else if(!empty($maarch_module) && isset($maarch_module)&& isset($img_name) && !empty($img_name))
+		{
+			$img_path = $_SESSION['urltomodules'].$maarch_module.'img/'.$img_name;
+		}
+		else
+		{
+			$img_path = $_SESSION['config']['businessappurl'].'img/default_status'.$extension.'.gif';
+		}
+
+		if(empty($status_txt) || !isset($status_txt))
+		{
+			$status_txt = $id_status;
+		}
+
+		return array('ID'=> $id_status, 'LABEL'=> $status_txt, 'IMG_SRC' => $img_path);
+	}
+
+	public function can_be_modified($id_status)
+	{
+		$this->connect();
+		$this->query("select can_be_modified from ".$_SESSION['tablename']['status']." where id = '".$id_status."'");
+		if($this->nb_result() == 0)
+		{
+			return false;
+		}
+		$res = $this->fetch_object();
+		if($res->can_be_modified == 'N')
+		{
+			return false;
+		}
+		return true;
+	}
+}
diff --git a/core/trunk/core/class/class_portal.php b/core/trunk/core/class/class_portal.php
new file mode 100644
index 00000000000..c74b90746d5
--- /dev/null
+++ b/core/trunk/core/class/class_portal.php
@@ -0,0 +1,83 @@
+<?php 
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the functions to use a maarch portal
+*
+* @file
+* @author  Laurent Giovannoni  <dev@maarch.org>
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the functions to use a maarch portal
+*
+* @ingroup core
+*/
+class portal extends functions
+{
+
+	/**
+	* Loads Maarch portal configuration into sessions  from an xml configuration file (core/xml/config.xml)
+	*/
+	public function build_config()
+	{
+		$xmlconfig = simplexml_load_file('core/xml/config.xml');
+		foreach($xmlconfig->CONFIG as $CONFIG)
+		{
+			$_SESSION['config']['corename'] = (string) $CONFIG->corename;
+			$_SESSION['config']['corepath'] = (string) $CONFIG->corepath;
+			$_SESSION['config']['tmppath'] = (string) $CONFIG->tmppath;
+			$_SESSION['config']['unixserver'] = (string) $CONFIG->unixserver;
+			$_SESSION['config']['defaultpage'] = (string) $CONFIG->defaultpage;
+			$_SESSION['config']['defaultlang'] = (string) $CONFIG->defaultlanguage;
+			//$_SESSION['config']['coreurl'] = (string) $CONFIG->coreurl;
+			if ($_SERVER['SERVER_PORT'] <> 80)
+			{
+				$server_port = ":".$_SERVER['SERVER_PORT'];
+			}
+			else
+			{
+				$server_port = '';
+			}
+			$_SESSION['config']['coreurl'] = "http://".$_SERVER['SERVER_NAME'].$server_port.str_replace('index.php','',$_SERVER['SCRIPT_NAME']);
+		}
+		$i=0;
+		foreach($xmlconfig->BUSINESSAPPS as $BUSINESSAPPS)
+		{
+			$_SESSION['businessapps'][$i] = array("appid" => (string) $BUSINESSAPPS->appid,
+																			"comment" => (string) $BUSINESSAPPS->comment);
+		$i++;
+		}
+	}
+
+	/**
+	* Unset session variabless
+	*/
+	public function unset_session()
+	{
+		unset($_SESSION['config']);
+		unset($_SESSION['businessapps']);
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_request.php b/core/trunk/core/class/class_request.php
new file mode 100644
index 00000000000..1ec217c0674
--- /dev/null
+++ b/core/trunk/core/class/class_request.php
@@ -0,0 +1,386 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the function to build a SQL query
+*
+* @file
+* @author  Loïc Vinet  <dev@maarch.org>
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the function to build a SQL query (select, insert and update)
+*
+* @ingroup core
+*/
+class request extends dbquery
+{
+	/**
+	* Constructs the select query and returns the results in an array
+	*
+	* @param  $select array Query fields
+	* @param  $where  string Where clause of the query
+	* @param  $other  string Query complement (order by, ...)
+	* @param  $database_type string Type of the database (MYSQL, POSTGRESQL, ...)
+	* @param  $limit string Maximum numbers of results (500 by default)
+	* @param  $left_join boolean Is the request is a left join ? (false by default)
+	* @param  $first_join_table string Name of the first join table (empty by default)
+	* @param  $second_join_table string Name of the second join table (empty by default)
+	* @param  $join_key string  Key of the join (empty by default)
+	* @param  $add_security string  Add the user security where clause or not (true by default)
+	* @param  $distinct_argument  Add the distinct parameters in the sql query (false by default)
+	* @return array Results of the built query
+	*/
+	public function select($select, $where, $other, $database_type, $limit="default", $left_join=false, $first_join_table="", $second_join_table="", $join_key="", $add_security = true, $catch_error = false, $distinct_argument = false)
+	{
+		if($limit == 0)
+		{
+			$limit=$_SESSION['config']['databasesearchlimit'];
+		}
+		elseif($limit == "default")
+		{
+			$limit=$_SESSION['config']['databasesearchlimit'];
+		}
+		//Extracts data in the first argument : $select.
+		$tab_field = array();
+		$table = '';
+		$table_string = '';
+		foreach (array_keys($select) as $value)
+		{
+			$table = $value;
+			$table_string .= $table.",";
+			foreach ($select[$value] as $subvalue)
+			{
+				$field = $subvalue;
+				$field_string .= $table.".".$field.",";
+			}
+			//Query fields and table names have been wrote in 2 strings
+		}
+		//Strings need to be cleaned
+		$table_string = substr($table_string, 0, -1);
+		$field_string = substr($field_string, 0, -1);
+
+		//Extracts data from the second argument : the where clause
+		if (trim($where) <> "")
+		{
+			$where_string = " where ".$where;
+		}
+		else
+		{
+			$where_string = "";
+		}
+
+		if($left_join)
+		{
+			//Reste table string
+			$table_string = "";
+
+			//Add more table in join syntax
+			foreach (array_keys($select) as $value)
+			{
+				if ($value <> $first_join_table && $value <> $second_join_table)
+				{
+					$table_string = $value.",";
+				}
+			}
+
+			$join = " left join ";
+			$table_string .= $first_join_table;
+			$join .= $second_join_table." on ".$second_join_table.".".$join_key." = ".$first_join_table.".".$join_key;
+		}
+
+		$where2 = "";
+		for($i=0; $i < count($_SESSION['user']['security']); $i++)
+		{
+			if(isset($_SESSION['user']['security'][$i]['table']) && isset($_SESSION['user']['security'][$i]['coll_id']))
+			{
+				if(preg_match('/'.$_SESSION['user']['security'][$i]['table'].'/',$table_string) )
+				{
+					if(empty($where))
+					{
+						$where2 = " where ( ".$_SESSION['user']['security'][$i]['where']." ) ";
+					}
+					else
+					{
+						$where2 = " and ( ".$_SESSION['user']['security'][$i]['where']." ) ";
+					}
+				}
+			}
+		}
+		//Time to create the SQL Query
+		$query = "";
+		if($distinct_argument == true)
+		{
+			$dist = " distinct ";
+		}
+		if($database_type == "SQLSERVER")
+		{
+			$query = "SELECT TOP ".$limit." ".$dist.$field_string." FROM ".$table_string." ".$join." ".$where_string." ".$other;
+		}
+		elseif($database_type == "MYSQL" )
+		{
+			$query = "SELECT ".$dist.$field_string." FROM ".$table_string.' '.$join.' '.$where_string." ".$other." LIMIT 0,".$limit." ";
+		}
+		elseif($database_type == "POSTGRESQL" )
+		{
+			$query = "SELECT ".$dist.$field_string." FROM ".$table_string.' '.$join.' '.$where_string." ".$other." OFFSET 0 LIMIT ".$limit." ";
+		}
+		elseif($database_type == "ORACLE" )
+		{
+			if ($limit <> '')
+			{
+				$orcl_limit = $limit;
+				$orcl_limit = " rownum <= ".$orcl_limit;
+				if ($where_string <> '') { $orcl_limit = " and ".$orcl_limit; } else { $orcl_limit = " where ".$orcl_limit; }
+			}
+			$query = "SELECT ".$dist.$field_string." FROM ".$table_string.' '.$join.' '.$where_string." ".$orcl_limit." ".$other." ";
+		}
+		$this->connect();
+		$this->query($query, $catch_error);
+
+		$result=array();
+		while($line = $this->fetch_array())
+		{
+			$temp= array();
+            foreach (array_keys($line) as $resval)
+            {
+            	if (!is_int($resval))
+            	{
+					if ($_SESSION['config']['databasetype'] == "ORACLE")
+					{
+						array_push($temp,array('column'=>strtolower($resval),'value'=>$line[$resval]));
+					}
+					else
+					{
+						array_push($temp,array('column'=>$resval,'value'=>$line[$resval]));
+					}
+            	}
+            }
+			array_push($result,$temp);
+		}
+		return $result;
+	}
+
+	/**
+	* Builds the insert query and sends it to the database
+	*
+	* @param string $table table to insert
+	* @param array $data data to insert
+	* @param array $database_type type of the database (MYSQL, POSTGRESQL, ...)
+	* @return bool True if the query was sent ok and processed by the database without error, False otherwise
+	*/
+	public function insert($table, $data, $database_type)
+	{
+		$field_string = "( ";
+		$value_string = "( ";
+
+		for($i=0; $i < count($data);$i++)
+		{
+			$field_string .= $data[$i]['column'].",";
+			if($data[$i]['type'] == "string" || $data[$i]['type'] == "date")
+			{
+				$value_string .= "'".$data[$i]['value']."',";
+			}
+			else
+			{
+				$value_string .= $data[$i]['value'].",";
+			}
+		}
+		$value_string = substr($value_string, 0, -1);
+		$field_string = substr($field_string, 0, -1);
+
+		$value_string .= ")";
+		$field_string .= ")";
+
+		//Time to create the SQL Query
+		$query = "";
+		$query = "INSERT INTO ".$table." ".$field_string." VALUES ".$value_string ;
+
+		$this->connect();
+		return ($this->query($query, true));
+	}
+
+	/**
+	* Constructs the update query and sends it to the database
+	*
+	* @param  $table string Table to update
+	* @param  $data array Data to update
+	* @param  $where array Where clause of the query
+	* @param  $database_type array Type of the database (MYSQL, POSTGRESQL, ...)
+	*/
+	public function update($table, $data, $where, $databasetype)
+	{
+		$update_string = "";
+		for($i=0; $i < count($data);$i++)
+		{
+			if($data[$i]['type'] == "string" || $data[$i]['type'] == "date")
+			{
+				if($databasetype == "POSTGRESQL" && $data[$i]['type'] == "date" && ($data[$i]['value'] == '' || $data[$i]['value'] == ' '))
+				{
+					$update_string .= $data[$i]['column']."=NULL,";
+				}
+				else
+				{
+					$update_string .= $data[$i]['column']."='".$data[$i]['value']."',";
+				}
+			}
+			else
+			{
+				$update_string .= $data[$i]['column']."=".$data[$i]['value'].",";
+			}
+		}
+		$update_string = substr($update_string, 0, -1);
+		if ($where <> "")
+		{
+			$where_string = " WHERE ".$where;
+		}
+		else
+		{
+			$where_string = "";
+		}
+		//Time to create the SQL Query
+		$query = "";
+		$query = "UPDATE ".$table." SET ".$update_string.$where_string ;
+		$this->connect();
+		$this->query($query);
+	}
+
+	/**
+	* Return current datetime instruction for each SQL database
+	*
+	* @author  Loïc Vinet  <dev@maarch.org
+	*/
+	public function current_datetime()
+	{
+
+		if($_SESSION['config']['databasetype'] == "SQLSERVER")
+		{
+			return ' getdate() ';
+		}
+		elseif( ($_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL"))
+		{
+			return ' now() ';
+		}
+		elseif($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+			return ' current_date ';
+		}
+	}
+
+	/**
+	* Returns the correct SQL instruction (depending of the database type) for extracting a date or a date part from a datetime field
+	*
+	* @param $date_field String The name of the date field
+	* @param $arg String Date part : 'year', 'month', 'day', 'hour', 'minute' or 'second'; if empty return the all date, empty by default
+	* @return String SQL instruction
+	*/
+	public function extract_date($date_field, $arg = '')
+	{
+
+		if($_SESSION['config']['databasetype'] == "SQLSERVER")
+		{
+			// TO DO
+			return $date_field;
+		}
+		elseif( $_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL" )
+		{
+			if(empty($arg))
+			{
+				return ' date('.$date_field.')';
+			}
+			else
+			{
+				if($_SESSION['config']['databasetype'] == "MYSQL")
+				{
+					switch($arg)
+					{
+						case 'year' :
+							return ' date_format('.$date_field.', %Y)';
+						case 'month' :
+							return ' date_format('.$date_field.', %m)';
+						case 'day' :
+							return ' date_format('.$date_field.', %d)';
+						case 'hour' :
+							return ' date_format('.$date_field.', %k)';
+						case 'minute' :
+							return ' date_format('.$date_field.', %i)';
+						case 'second' :
+							return ' date_format('.$date_field.', %s)';
+						default	 :
+							return ' date('.$date_field.')';
+					}
+				}
+				else if($_SESSION['config']['databasetype'] == "POSTGRESQL")
+				{
+					switch($arg)
+					{
+						case 'year' :
+							return " date_part( 'year', ".$date_field.")";
+						case 'month' :
+							return " date_part( 'month', ".$date_field.")";
+						case 'day' :
+							return " date_part( 'day', ".$date_field.")";
+						case 'hour' :
+							return " date_part( 'hour', ".$date_field.")";
+						case 'minute' :
+							return " date_part( 'minute', ".$date_field.")";
+						case 'second' :
+							return " date_part( 'second', ".$date_field.")";
+						default	 :
+							return ' date('.$date_field.')';
+					}
+				}
+
+			}
+		}
+		elseif($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+			// TO DO
+			return $date_field;
+		}
+	}
+
+	public function get_date_diff($date1, $date2)
+	{
+		if($_SESSION['config']['databasetype'] == "MYSQL")
+		{
+			return 'datediff('.$date1.', '.$date2.')';
+		}
+		elseif($_SESSION['config']['databasetype'] == "POSTGRESQL")
+		{
+			return $this->extract_date($date1).' - '.$this->extract_date($date2);
+		}
+		elseif($_SESSION['config']['databasetype'] == "ORACLE")
+		{
+				// TO DO
+			return '';
+		}
+		else if($_SESSION['config']['databasetype'] == "SQLSERVER")
+		{
+			// TO DO
+			return '';
+		}
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_resource.php b/core/trunk/core/class/class_resource.php
new file mode 100644
index 00000000000..c00dd5dced6
--- /dev/null
+++ b/core/trunk/core/class/class_resource.php
@@ -0,0 +1,352 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the function to manage the resources
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   Contains all the function to manage the resources
+*
+* <ul>
+*<li>Standardized methods to insert, update and delete a resource</li>
+*</ul>
+* @ingroup core
+*/
+ class resource extends request
+{
+
+	/**
+	* Resource identifier
+	* Integer
+	*/
+	private $res_id;
+
+
+	/**
+	* Type identifier of the resource
+	* String
+	*/
+	private $type_id;
+
+	/**
+	* Person who inserts the resource in the application
+	* String
+	*/
+	private $typist;
+
+	/**
+	* File format of the resource
+	* String
+	*/
+	private $format;
+
+	/**
+	* Docserver identifier of the resource
+	* String
+	*/
+	private $docserver_id;
+
+	/**
+	* Path of the resource in the docserver
+	* String
+	*/
+	private $path;
+
+	/**
+	* Fingerprint of the resource
+	* String
+	*/
+	private $fingerprint;
+
+	/**
+	* File name of the resource
+	* String
+	*/
+	private $filename;
+
+	/**
+	* File Size of the resource
+	* Integer
+	*/
+	private $filesize;
+
+	/**
+	* Offset
+	* Integer
+	*/
+	private $offset;
+
+	/**
+	* Logical address
+	* Integer
+	*/
+	private $log_adr;
+
+	/**
+	* Status of the resource
+	* String
+	*/
+	private $status;
+
+	/**
+	* Error message
+	* String
+	*/
+	private $error;
+
+	/**
+	* Inserts the Resource Object data into the data base
+	*
+ 	* @param  $table_res string Resource table where to insert
+	* @param  $path  string Resource path in the docserver
+	* @param  $filename string Resource file name
+	* @param  $docserver_path  string Docserver path
+	* @param  $docserver_id  string Docserver identifier
+	* @param  $data  array Data array
+	* @param  $databasetype string Type of the db (MYSQL, SQLSERVER, ...)
+	*/
+	function load_into_db( $table_res, $path, $filename, $docserver_path, $docserver_id, $data, $databasetype)
+	{
+		$filetmp = $docserver_path;
+		$tmp = $path;
+		$tmp = str_replace('#',DIRECTORY_SEPARATOR,$tmp);
+		$filetmp .= $tmp;
+		$filetmp .= $filename;
+		$md5 = md5_file($filetmp);
+		$filesize = filesize($filetmp);
+
+
+		array_push($data, array('column' => "fingerprint", 'value' => $md5, 'type' => "string"));
+		array_push($data, array('column' => "filesize", 'value' => $filesize, 'type' => "int"));
+		array_push($data, array('column' => "path", 'value' => $path, 'type' => "string"));
+		array_push($data, array('column' => "filename", 'value' => $filename, 'type' => "string"));
+		array_push($data, array('column' => 'creation_date', 'value' => $this->current_datetime(), 'type' => "function"));
+
+		if(!$this->check_basic_fields($data))
+		{
+			$_SESSION['error'] = $this->error;
+			return false;
+		}
+		else
+		{
+			if(!$this->insert($table_res, $data, $_SESSION['config']['databasetype']))
+			{
+				$this->error = _INDEXING_INSERT_ERROR."<br/>".$this->show();
+				return false;
+			}
+			else
+			{
+				$this->connect();
+				$this->query("select res_id from ".$table_res." where docserver_id = '".$docserver_id."' and path = '".$path."' and filename= '".$filename."'");
+				//$this->show();
+				$res = $this->fetch_object();
+				return $res->res_id;
+			}
+		}
+	}
+
+	/**
+	* Gets the resource identifier
+	*
+	* @return integer Resource identifier (res_id)
+	*/
+	public function get_id()
+ 	{
+ 		return $this->res_id;
+ 	}
+
+	/**
+	* Gets the error message of the resource object
+	*
+	* @return string Error message of the resource object
+	*/
+	public function get_error()
+ 	{
+ 		return $this->error;
+ 	}
+
+	/**
+	* Checks the mininum fields required for an insert into the database
+	*
+	* @param  $data array Array of the fields to insert into the database
+	* @return bool True if all the fields are ok, False otherwise
+         */
+	private function check_basic_fields($data)
+	{
+		$error = '';
+		$this->connect();
+		$find_format = false;
+		$find_typist = false;
+		$find_creation_date = false;
+		$find_docserver_id = false;
+		$find_path = false;
+		$find_filename = false;
+		$find_offset = false;
+		$find_logical_adr = false;
+		$find_fingerprint = false;
+		$find_filesize = false;
+		$find_status = false;
+		for($i=0; $i < count($data);$i++)
+		{
+			if($data[$i]['column'] == 'format')
+			{
+				$find_format = true;
+				// must be tested in the file_index.php file (module = indexing_searching)
+			}
+			elseif($data[$i]['column'] == 'typist' )
+			{
+				$find_typist = true;
+/*
+				if( $data[$i]['value'] <> $_SESSION['user']['UserId'])
+				{
+					$error .= _TYPIST_ERROR.'<br/>';
+				}
+*/
+			}
+			elseif($data[$i]['column'] == 'creation_date')
+			{
+				$find_creation_date = true;
+				if($data[$i]['value'] <> $this->current_datetime())
+				{
+					$error .= _CREATION_DATE_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == 'docserver_id')
+			{
+				$find_docserver_id =  true;
+				if(!$this->query("select docserver_id from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$data[$i]['value']."'", true))
+				{
+					$error .= _DOCSERVER_ID_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == 'path' )
+			{
+				$find_path = true;
+				if( empty($data[$i]['value']))
+				{
+					$error .= _PATH_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == 'filename' )
+			{
+				$find_filename = true;
+				if(!preg_match("/^[0-9]+.([a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]?|maarch)$/", $data[$i]['value']))
+				{
+					$error .= _FILENAME_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == "offset_doc")
+			{
+				$find_offset = true;
+			}
+			elseif($data[$i]['column'] == 'logical_adr')
+			{
+				$find_logical_adr = true;
+			}
+			elseif($data[$i]['column'] == 'fingerprint'  )
+			{
+				$find_fingerprint  = true;
+				if(!preg_match("/^[0-9A-Fa-f]+$/", $data[$i]['value']))
+				{
+					$error .= _FINGERPRINT_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == 'filesize'  )
+			{
+				$find_filesize = true;
+				if( $data[$i]['value'] <= 0)
+				{
+					$error .= _FILESIZE_ERROR.'<br/>';
+				}
+			}
+			elseif($data[$i]['column'] == 'status' )
+			{
+				$find_status = true;
+				if( !preg_match("/^[A-Z][A-Z][A-Z][A-Z]*$/", $data[$i]['value']))
+				{
+					$error .= _STATUS_ERROR.'<br/>';
+				}
+			}
+		}
+
+		if($find_format == false)
+		{
+			$error .= _MISSING_FORMAT.'<br/>';
+		}
+		if($find_typist == false)
+		{
+			$error .= _MISSING_TYPIST.'<br/>';
+		}
+		if($find_creation_date == false)
+		{
+			$error .= _MISSING_CREATION_DATE.'<br/>';
+		}
+		if($find_docserver_id == false)
+		{
+			$error .= _MISSING_DOCSERVER_ID.'<br/>';
+		}
+		if($find_path == false)
+		{
+			$error .= _MISSING_PATH.'<br/>';
+		}
+		if($find_filename == false)
+		{
+			$error .= _MISSING_FILENAME.'<br/>';
+		}
+		if($find_offset == false)
+		{
+			$error .= _MISSING_OFFSET.'<br/>';
+		}
+		if($find_logical_adr == false)
+		{
+			$error .= _MISSING_LOGICAL_ADR.'<br/>';
+		}
+		if($find_fingerprint == false)
+		{
+			$error .= _MISSING_FINGERPRINT.'<br/>';
+		}
+		if($find_filesize == false)
+		{
+			$error .= _MISSING_FILESIZE.'<br/>';
+		}
+		if($find_status == false)
+		{
+			$error .= _MISSING_STATUS.'<br/>';
+		}
+
+		$this->error = $error;
+		if(!empty($error))
+		{
+			return false;
+		}
+		else
+		{
+			return true;
+		}
+	}
+}
+?>
diff --git a/core/trunk/core/class/class_security.php b/core/trunk/core/class/class_security.php
new file mode 100644
index 00000000000..7661b3e2b39
--- /dev/null
+++ b/core/trunk/core/class/class_security.php
@@ -0,0 +1,1283 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Contains all the functions to manage the users groups security and connexion to the application
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+
+/**
+* @brief   contains all the functions to manage the users groups security through session variables
+*
+*<ul>
+*  <li>Management of application connexion</li>
+*  <li>Management of user rigths</li>
+*</ul>
+* @ingroup core
+*/
+
+//Requires to launch history functions
+require_once($_SESSION['pathtocoreclass']."class_history.php");
+
+
+
+class security extends dbquery
+{
+
+	/**
+	* Loads the security parameters for a group into session variables.
+	*
+	* @param  $group_id string User group identifier
+	*/
+	public function load_security_group($group_id)
+	{
+		$tab = array();
+		$this->connect();
+		$this->query("select * from ".$_SESSION['tablename']['security'] ." where group_id = '".$group_id."'");
+
+		if($this->nb_result() == 0)
+		{
+			$_SESSION['m_admin']['groups']['security'] = array();
+		}
+		else
+		{
+			$_SESSION['m_admin']['groups']['security'] = array();
+
+			while($res = $this->fetch_object())
+			{
+				$ind = $this->get_ind_collection($res->coll_id);
+				array_push($_SESSION['m_admin']['groups']['security'],array("GROUP_ID" => $res->group_id,"COLL_ID" => $res->coll_id, "IND_COLL_SESSION" => $ind, "WHERE_CLAUSE" => $res->where_clause, "MAARCH_COMMENT" => $res->commment ,"CAN_INSERT" => $res->can_insert ,"CAN_UPDATE" => $res->can_update, "CAN_DELETE" => $res->can_delete));
+			}
+		}
+		$_SESSION['m_admin']['load_security'] = false;
+	}
+
+	/**
+	* Gets the indice of the collection in the  $_SESSION['collections'] array
+	*
+	* @param  $coll_id string  Collection identifier
+	* @return integer Indice of the collection in the $_SESSION['collections'] or -1 if not found
+	*/
+	public function get_ind_collection($coll_id)
+	{
+		for($i=0;$i< count($_SESSION['collections']); $i++)
+		{
+			if(trim($_SESSION['collections'][$i]['id']) == trim($coll_id))
+			{
+				return $i;
+			}
+		}
+		return -1;
+	}
+
+	/**
+	* Loads the services of a user group in session variables.
+	*
+	* @param  $group_id string User group identifier
+	*/
+	public function load_services_group($group_id)
+	{
+		$this->connect();
+		$this->query("select service_id from ".$_SESSION['tablename']['usergroup_services'] ." where group_id = '".$group_id."'");
+		if($this->nb_result() == 0)
+		{
+			$_SESSION['m_admin']['groups']['services'] = array();
+		}
+		else
+		{
+			$_SESSION['m_admin']['groups']['services']=array();
+			while($value = $this->fetch_object())
+			{
+				array_push($_SESSION['m_admin']['groups']['services'],$value->service_id);
+			}
+		}
+		$_SESSION['m_admin']['load_services'] = false;
+	}
+
+	/**
+	* Inits the session variables related to the user group administration.
+	*
+	*/
+	public function init_session()
+	{
+		$_SESSION['m_admin']['groups'] = array();
+		$_SESSION['m_admin']['groups']['GroupId'] = "";
+		$_SESSION['m_admin']['groups']['desc'] = "";
+		$_SESSION['m_admin']['groups']['security'] = array();
+		$_SESSION['m_admin']['groups']['services'] = array();
+		$_SESSION['m_admin']['init'] = false;
+	}
+
+	/**
+	* Inits to ‘N’ (no) the rights in the session variables related to the user group administration.
+	*
+	*/
+	public function init_rights_session()
+	{
+		for($i=0; $i < count($_SESSION['m_admin']['groups']['security']); $i++)
+		{
+			$_SESSION['m_admin']['groups']['security'][$i]['CAN_INSERT'] = 'N';
+			$_SESSION['m_admin']['groups']['security'][$i]['CAN_UPDATE'] = 'N';
+			$_SESSION['m_admin']['groups']['security'][$i]['CAN_DELETE'] = 'N';
+		}
+	}
+
+	/**
+	* Set the rights (insert or update, depending on the parameter) for the collection passed on parameters.
+	*
+	* @param   $coll_id string Collection identifier
+	* @param  $where  string 'CAN_INSERT', 'CAN_DELETE', or 'CAN_UPDATE'
+	*/
+	public function set_rights_session($coll_id, $where)
+	{
+		for($i=0; $i < count($_SESSION['m_admin']['groups']['security']); $i++)
+		{
+			if( in_array($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'], $coll_id))
+			{
+				$_SESSION['m_admin']['groups']['security'][$i][$where] = 'Y';
+			}
+		}
+		$tab = array();
+	}
+
+	/**
+	* Removes the security rights on the collections passed in parameters.
+	*
+	* @param   $tab array  Collections rights array
+	*/
+	public function remove_security($tab)
+	{
+		$unset_id = array();
+		for($j=0;$j<count($tab);$j++)
+		{
+			for($i=0;$i<count($_SESSION['m_admin']['groups']['security']);$i++)
+			{
+				if(trim($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']) == trim($tab[$j]))
+				{
+					unset($_SESSION['m_admin']['groups']['security'][$i]);
+				//	array_push($_SESSION['m_admin']['groups']['security'], $i);
+				}
+			}
+		}
+		$_SESSION['m_admin']['groups']['security'] = array_values($_SESSION['m_admin']['groups']['security']);
+	}
+
+	/**
+	* Adds security parameters of a group in the session variables related to the user group administration.
+	*
+	* @param   $coll_id string Collection identifier
+	* @param   $where string Where clause : security
+	* @param   $comment string Comment on the collection
+	* @param   $insert string Insert right : Y/N
+	* @param   $update string Update right : Y/N
+	* @param   $delete string Update right : Y/N
+	* @param   $mode string Mode : 'up' or 'add'
+	*/
+	public function add_grouptmp_session($coll_id, $where, $comment, $insert, $update, $delete, $mode)
+	{
+		if(empty($mode))
+		{
+			$_SESSION['error'] = _ERROR_SECURITY_LOADING;
+		}
+		elseif($mode == "up")
+		{
+			for($i=0;$i< count($_SESSION['m_admin']['groups']['security']);$i++)
+			{
+				if($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'] == $coll_id)
+				{
+					$_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'] = $where;
+					$_SESSION['m_admin']['groups']['security'][$i]['COMMENT'] = $comment;
+					$_SESSION['m_admin']['groups']['security'][$i]['CAN_INSERT'] = $insert;
+					$_SESSION['m_admin']['groups']['security'][$i]['CAN_UPDATE'] = $update;
+					$_SESSION['m_admin']['groups']['security'][$i]['CAN_DELETE'] = $delete;
+					break;
+				}
+			}
+		}
+		else
+		{
+			$ind = $this->get_ind_collection($coll_id);
+			$tab = array();
+			$tab[0] = array("GROUP_ID" => "" , "COLL_ID" => $coll_id , "IND_COLL_SESSION" => $ind,"WHERE_CLAUSE" => $where, "MAARCH_COMMENT" => $comment ,"CAN_INSERT" => $insert ,"CAN_UPDATE" => $update, 'CAN_DELETE' => $delete);
+			array_push($_SESSION['m_admin']['groups']['security'] , $tab[0]);
+			$_SESSION['m_admin']['load_security'] = false;
+		}
+	}
+
+	/**
+	* Updates the database with the user groups security of the administration variables in session.
+	*
+	*/
+	public function load_db()
+	{
+		$this->connect();
+		$this->query("DELETE FROM ".$_SESSION['tablename']['security'] ." where group_id = '".$_SESSION['m_admin']['groups']['GroupId']."'");
+		for($i=0; $i < count($_SESSION['m_admin']['groups']['security'] ); $i++)
+		{
+			if($_SESSION['m_admin']['groups']['security'][$i] <> "")
+			{
+				$this->query("INSERT INTO ".$_SESSION['tablename']['security']." VALUES ('".$_SESSION['m_admin']['groups']['GroupId']."', '".$_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']."', '".$this->protect_string_db($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'])."', '".$_SESSION['m_admin']['groups']['security'][$i]['COMMENT']."', '".$_SESSION['m_admin']['groups']['security'][$i]['CAN_INSERT']."' , '".$_SESSION['m_admin']['groups']['security'][$i]['CAN_UPDATE']."', '".$_SESSION['m_admin']['groups']['security'][$i]['CAN_DELETE']."')");
+			}
+		}
+	}
+
+	/**
+	* Tests the syntax of the where clause of all collections for a  usergroup
+	*
+	* @return bool True if the syntax is correct, False otherwise
+	*/
+	public function where_test()
+	{
+		$_SESSION['error'] = "";
+		$this->connect();
+		$where = "";
+		$res2 = true;
+		for($i=0; $i < count($_SESSION['m_admin']['groups']['security'] ); $i++)
+		{
+			if($_SESSION['m_admin']['groups']['security'][$i] <> "")
+			{
+				if(trim($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE']) == '')
+				{
+					$where = " ";
+					$_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'] = ' ';
+				}
+				else
+				{
+					$where = " ".$_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'] ;
+					$where = str_replace("\\", "", $where);
+					$where = $this->process_security_where_clause($where, $_SESSION['user']['UserId']);
+				}
+				$ind = $this->get_ind_collection($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID']);
+				$selectWhereTest = array();
+				$selectWhereTest[$_SESSION['collections'][$ind]['view']]= array();
+				array_push($selectWhereTest[$_SESSION['collections'][$ind]['view']],"res_id");
+				$tabResult = array();
+				require_once($_SESSION['pathtocoreclass']."class_request.php");
+				$request = new request();
+				if(str_replace(" ", "", $where) == "")
+				{
+					$where = "";
+				}
+				$where = str_replace("where", " ", $where);
+				$tabResult = $request->select($selectWhereTest, $where, "", $_SESSION['config']['databasetype'], 10, false, "", "", "", true, true);
+				//$this->query("SELECT count(*) from ".$_SESSION['collections'][$ind]['view']." ".$where, true);
+				if(!$request->query  && $_SESSION['config']['databasetype'] <> "ORACLE")
+				{
+					$_SESSION['error'] .= " ".$_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'];
+					$res2 = false;
+					break;
+				}
+			}
+		}
+		return $res2;
+	}
+
+	/**
+	* Loads data related to the user groups (group name, role, primary group or not) into session variables
+	*
+	*/
+	public function load_groups($user_id)
+	{
+		$tab['groups'] = array();
+		$tab['primarygroup'] = '';
+		//$_SESSION['user']['groups'] = array();
+		//$_SESSION['user']['primarygroup'] ="";
+		$this->connect();
+		if($user_id == "superadmin")
+		{
+			$this->query("select group_id from ".$_SESSION['tablename']['usergroups']." where enabled= 'Y'");
+			if($this->nb_result() < 1)
+			{
+				$_SESSION['error'] = _USER_NO_GROUP.'. '._MORE_INFOS." <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+				header("location: ".$_SESSION['config']['businessappurl']."index.php");
+				exit();
+			}
+			else
+			{
+				$i =0;
+				while($line = $this->fetch_object())
+				{
+
+					//$_SESSION['user']['groups'][$i]['GROUP_ID'] = $line->group_id;
+					$tab['groups'][$i]['GROUP_ID'] = $line->group_id;
+					$tab['groups'][$i]['ROLE'] = '';
+					//$_SESSION['user']['groups'][$i]['ROLE'] = '';
+					$i++;
+				}
+			}
+		}
+		else
+		{
+			$this->query("select uc.group_id, uc.primary_group, uc.role from ".$_SESSION['tablename']['usergroup_content']." uc , ".$_SESSION['tablename']['usergroups']." u where uc.user_id ='".$user_id."' and u.group_id = uc.group_id and u.enabled= 'Y'");
+			if($this->nb_result() < 1)
+			{
+				$_SESSION['error'] = _USER_NO_GROUP.'. '._MORE_INFOS." <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+				header("location: ".$_SESSION['config']['businessappurl']."index.php");
+				exit();
+			}
+			else
+			{
+				$i =0;
+				while($line = $this->fetch_object())
+				{
+					//$_SESSION['user']['groups'][$i]['GROUP_ID'] = $line->group_id;
+					$tab['groups'][$i]['GROUP_ID'] = $line->group_id;
+					if($line->primary_group == 'Y')
+					{
+						//$_SESSION['user']['primarygroup'] = $line->group_id;
+						$tab['primarygroup'] = $line->group_id;
+					}
+					//$_SESSION['user']['groups'][$i]['ROLE'] = $line->role;
+					$tab['groups'][$i]['ROLE'] = $line->role;
+					$i++;
+				}
+			}
+		}
+		return $tab;
+	}
+
+	/**
+	* Loads into session, the security parameters corresponding to the user groups.
+	*
+	*/
+	public function load_security($user_id)
+	{
+		$tab['collections'] = array();
+		$tab['security'] = array();
+
+		$this->connect();
+
+		if($user_id == "superadmin")
+		{
+			$this->query("select s.group_id, s.coll_id, s.where_clause , s.can_insert, s.can_update, s.can_delete  from ".$_SESSION['tablename']['security']." s, ".$_SESSION['tablename']['usergroups']." u where  u.group_id = s.group_id and u.enabled = 'Y'");
+		}
+		else
+		{
+			$this->query("select s.group_id, s.coll_id, s.where_clause , s.can_insert, s.can_update,s.can_delete  from ".$_SESSION['tablename']['security']." s, ".$_SESSION['tablename']['usergroup_content']." ugc , ".$_SESSION['tablename']['usergroups']." u where ugc.user_id='".$user_id."' and ugc.group_id = s.group_id and ugc.group_id = u.group_id and u.enabled = 'Y'");
+		}
+		$i =0;
+		$can_index = false;
+		$can_postindex = false;
+		while($line = $this->fetch_object())
+		{
+			$where_clause = $line->where_clause;
+			$where_clause = $this->process_security_where_clause($where_clause, $user_id);
+			$where_clause = str_replace('where', '', $where_clause);
+			if( ! in_array($line->coll_id, $tab['collections'] ) )
+			{
+				$tab['security'][$i]['coll_id'] = $line->coll_id;
+				$ind = $this->get_ind_collection($line->coll_id);
+				$tab['security'][$i]['table'] = $_SESSION['collections'][$ind]['table'];
+				$tab['security'][$i]['label_coll'] = $_SESSION['collections'][$ind]['label'];
+				$tab['security'][$i]['view'] =  $_SESSION['collections'][$ind]['view'];
+				if(trim($where_clause) <> "" && $where_clause <> " "  )
+				{
+					$where =  "( ".$this->show_string($where_clause)." )";
+				}
+				else
+				{
+					$where = "( 1=1 )";
+				}
+				$tab['security'][$i]['where'] = $where;
+				$tab['security'][$i]['can_insert'] = $line->can_insert;
+				$tab['security'][$i]['can_update'] = $line->can_update;
+				$tab['security'][$i]['can_delete'] = $line->can_delete;
+				array_push($tab['collections'] , $line->coll_id);
+				$i++;
+			}
+			else
+			{
+				$key = array_search($line->coll_id, $tab['collections'] );
+				if(trim($where_clause) == "")
+				{
+					$where = "( 1=1 )";
+				}
+				else
+				{
+					$where =  "( ".$this->show_string($where_clause)." )";
+				}
+				$tab['security'][$key]['where'] .= " or ".$where;
+				if($line->can_insert == 'Y')
+				{
+					$tab['security'][$key]['can_insert'] = $line->can_insert;
+				}
+				if($line->can_update == 'Y')
+				{
+					$tab['security'][$key]['can_update'] = $line->can_update;
+				}
+				if($line->can_delete == 'Y')
+				{
+					$tab['security'][$key]['can_delete'] = $line->can_update;
+				}
+			}
+		}
+		return $tab;
+	}
+
+	/**
+	* Logs a user
+	*
+	* @param  $s_login  string User login
+	* @param  $pass string User password
+	*/
+	public function login($s_login,$pass)
+	{
+		$this->connect();
+
+
+		if ($_SESSION['config']['databasetype'] == "POSTGRESQL")
+			$query = "select * from ".$_SESSION['tablename']['users']." where user_id ilike '".$this->protect_string_db($s_login)."' and password = '".$pass."' and STATUS <> 'DEL'";
+
+		else
+			$query = "select * from ".$_SESSION['tablename']['users']." where user_id like '".$this->protect_string_db($s_login)."' and password = '".$pass."' and STATUS <> 'DEL'";
+
+		$this->query($query);
+
+		if($this->nb_result() > 0)
+		{
+			$line = $this->fetch_object();
+			if($line->enabled == "Y")
+			{
+				$_SESSION['user']['change_pass'] = $line->change_password;
+				$_SESSION['user']['UserId'] = $line->user_id;
+				$_SESSION['user']['FirstName'] = $line->firstname;
+				$_SESSION['user']['LastName'] = $line->lastname;
+				$_SESSION['user']['Phone'] = $line->phone;
+				$_SESSION['user']['Mail'] = $line->mail;
+				$_SESSION['user']['department'] = $line->department;
+				$_SESSION['error'] =  "";
+				setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$line->cookie_key,time()-3600000);
+				$key = md5(time()."%".$_SESSION['user']['FirstName']."%".$_SESSION['user']['UserId']."%".$_SESSION['user']['UserId']."%".date("dmYHmi")."%");
+
+				if ($_SESSION['config']['databasetype'] == "ORACLE")
+					$this->query("update ".$_SESSION['tablename']['users']." set cookie_key = '".$key."', cookie_date = SYSDATE where user_id = '".$_SESSION['user']['UserId']."' and mail = '".$_SESSION['user']['Mail']."'");
+				else
+					$this->query("update ".$_SESSION['tablename']['users']." set cookie_key = '".$key."', cookie_date = '".date("Y-m-d")." ".date("H:m:i")."' where user_id = '".$_SESSION['user']['UserId']."' and mail = '".$_SESSION['user']['Mail']."'");
+
+				setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$key,time()+($_SESSION['config']['cookietime']*1000));
+				$tmp = $this->load_groups($_SESSION['user']['UserId']);
+				$_SESSION['user']['groups'] = $tmp['groups'];
+				$_SESSION['user']['primarygroup'] = $tmp['primarygroup'];
+				$tmp = $this->load_security($_SESSION['user']['UserId']);
+				$_SESSION['user']['collections'] = $tmp['collections'];
+				$_SESSION['user']['security'] = $tmp['security'];
+				$this->load_enabled_services();
+				require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php");
+				require_once($_SESSION['pathtocoreclass']."class_core_tools.php");
+				$business_app_tools = new business_app_tools();
+				$core_tools = new core_tools();
+				$business_app_tools->load_app_var_session();
+				$core_tools->load_var_session($_SESSION['modules']);
+
+				$_SESSION['user']['services'] = $this->load_user_services($_SESSION['user']['UserId']);
+
+				$core_tools->load_menu($_SESSION['modules']);
+
+
+
+				if($_SESSION['history']['userlogin'] == "true")
+				{
+					require_once($_SESSION['pathtocoreclass']."class_history.php");
+					//add new instance in history table for the user's connexion
+					$hist = new history();
+					$ip = $_SERVER['REMOTE_ADDR'];
+					$navigateur = addslashes($_SERVER['HTTP_USER_AGENT']);
+
+					$hist->add($_SESSION['tablename']['users'],$_SESSION['user']['UserId'],"LOGIN","IP : ".$ip.", BROWSER : ".$navigateur , $_SESSION['config']['databasetype']);
+				}
+
+				if($_SESSION['user']['change_pass'] == 'Y')
+				{
+					header("location: ".$_SESSION['config']['businessappurl']."change_pass.php");
+					exit();
+				}
+/*
+				if($_SESSION['origin'] == "scan" && !$_SESSION['is_store'])
+				{
+					header("location: ../../modules/indexing_searching/index_file.php");
+					exit();
+				}
+				elseif($_SESSION['origin'] == "scan" && $_SESSION['is_store'])
+				{
+					header("location: ../../modules/indexing_searching/store_file.php");
+					exit();
+				}
+				elseif($_SESSION['req_type'] == "files")
+				{
+					header("location: ../../modules/indexing_searching/index_file.php");
+					exit();
+				}
+*/
+				elseif(trim($_SESSION['requestUri']) <> "")
+				{
+					header("location: ".$_SESSION['config']['businessappurl']."index.php?".$_SESSION['requestUri']);
+					exit();
+				}
+				else
+				{
+					header("location: ".$_SESSION['config']['businessappurl']."index.php");
+					exit();
+				}
+			}
+			else
+			{
+				$_SESSION['error'] = _SUSPENDED_ACCOUNT.'. '._MORE_INFOS." <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+				header("location: ".$_SESSION['config']['businessappurl']."index.php");
+				exit();
+			}
+		}
+		else
+		{
+			$_SESSION['error'] = _BAD_LOGIN_OR_PSW."&hellip;";
+			header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']);
+			exit();
+		}
+	}
+
+	/**
+	* Reopens a session with the user's cookie
+	*
+	* @param  $s_UserId  string User identifier
+	* @param  $s_key string Cookie key
+	*/
+	public function reopen($s_UserId,$s_key)
+	{
+		$this->connect();
+
+		if ($_SESSION['config']['databasetype'] == "POSTGRESQL")
+			$query = "select * from ".$_SESSION['tablename']['users']." where user_id ilike '".$this->protect_string_db($s_UserId)."' and cookie_key = '".$s_key."' and STATUS <> 'DEL'";
+		else
+			$query = "select * from ".$_SESSION['tablename']['users']." where user_id like '".$this->protect_string_db($s_UserId)."' and cookie_key = '".$s_key."' and STATUS <> 'DEL'";
+
+		$this->query($query);
+		if($this->nb_result() > 0)
+		{
+			$line = $this->fetch_object();
+			if($line->enabled == "Y")
+			{
+				$_SESSION['user']['UserId'] = $line->user_id;
+				$_SESSION['user']['FirstName'] = $line->firstname;
+				$_SESSION['user']['LastName'] = $line->lastname;
+				$_SESSION['user']['Phone'] = $line->phone;
+				$_SESSION['user']['Mail'] = $line->mail;
+				$_SESSION['user']['department'] = $line->department;
+				$_SESSION['error'] =  "";
+				setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$line->cookie_key,time()-3600000);
+				$key = md5(time()."%".$_SESSION['user']['FirstName']."%".$_SESSION['user']['UserId']."%".$_SESSION['user']['UserId']."%".date("dmYHmi")."%");
+				$this->query("update ".$_SESSION['tablename']['users']." set cookie_key = '".$key."', cookie_date = '".date("Y-m-d")." ".date("H:m:i")."' where user_id = '".$_SESSION['user']['UserId']."' and mail = '".$_SESSION['user']['Mail']."'");
+				setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$key,time()+($_SESSION['config']['cookietime']*60));
+
+				$tmp = $this->load_groups($_SESSION['user']['UserId']);
+				$_SESSION['user']['groups'] = $tmp['groups'];
+				$_SESSION['user']['primarygroup'] = $tmp['primarygroup'];
+
+				$tmp = $this->load_security($_SESSION['user']['UserId']);
+				$_SESSION['user']['collections'] = $tmp['collections'];
+				$_SESSION['user']['security'] = $tmp['security'];
+				$this->load_enabled_services();
+
+				require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_business_app_tools.php");
+				require_once($_SESSION['pathtocoreclass']."class_core_tools.php");
+				$business_app_tools = new business_app_tools();
+				$core_tools = new core_tools();
+				$business_app_tools->load_app_var_session();
+				$core_tools->load_var_session($_SESSION['modules']);
+
+				$_SESSION['user']['services'] = $this->load_user_services($_SESSION['user']['UserId']);
+				$core_tools->load_menu($_SESSION['modules']);
+/*
+				if($_SESSION['history']['userlogin'] == "true")
+				{
+					//add new instance in history table for the user's connexion
+					$hist = new history();
+					$ip = $_SERVER['REMOTE_ADDR'];
+					$navigateur = addslashes($_SERVER['HTTP_USER_AGENT']);
+
+					$hist->add($_SESSION['tablename']['users'],$_SESSION['user']['UserId'],"LOGIN","IP : ".$ip.", BROWSER : ".$navigateur , $_SESSION['config']['databasetype']);
+				}
+*/
+				if($_SESSION['user']['change_pass'] == 'Y')
+				{
+					header("location: ".$_SESSION['config']['businessappurl']."change_pass.php");
+					exit();
+				}
+				if($_SESSION['origin'] == "scan")
+				{
+					header("location: ../../modules/indexing_searching/index_file.php");
+					exit();
+				}
+				elseif($_SESSION['origin'] == "files")
+				{
+					header("location: ../../modules/indexing_searching/index_file.php");
+					exit();
+				}
+				else
+				{
+					header("location: ".$_SESSION['config']['businessappurl']."index.php");
+					exit();
+				}
+			}
+			else
+			{
+				$_SESSION['error'] = _SUSPENDED_ACCOUNT.'. '._MORE_INFOS." <a href=\"mailto:".$_SESSION['config']['adminmail']."\">".$_SESSION['config']['adminname']."</a>";
+				header("location: ".$_SESSION['config']['businessappurl']."index.php");
+				exit();
+			}
+		}
+		else
+		{
+			$_SESSION['error'] = _ERROR;
+			header("location: ".$_SESSION['config']['businessappurl']."login.php?coreurl=".$_SESSION['config']['coreurl']);
+			exit();
+		}
+	}
+
+	/**
+	* Loads the enabled services into session
+	*
+	*/
+	private function load_enabled_services()
+	{
+		$_SESSION['enabled_services'] = array();
+		for($i=0; $i<count($_SESSION['app_services']);$i++)
+		{
+			if($_SESSION['app_services'][$i]['enabled'] == "true")
+			{
+				array_push($_SESSION['enabled_services'], array('id' => $_SESSION['app_services'][$i]['id'], 'label' => $_SESSION['app_services'][$i]['name'], 'comment' =>$_SESSION['app_services'][$i]['comment'], 'type' => $_SESSION['app_services'][$i]['servicetype'],'parent' => 'application', 'system' => $_SESSION['app_services'][$i]['system_service']));
+			}
+		}
+		foreach(array_keys($_SESSION['modules_services']) as $value)
+		{
+			for($i=0; $i < count($_SESSION['modules_services'][$value]); $i++)
+			{
+				if($_SESSION['modules_services'][$value][$i]['enabled'] == "true")
+				{
+					array_push($_SESSION['enabled_services'], array('id' => $_SESSION['modules_services'][$value][$i]['id'], 'label' => $_SESSION['modules_services'][$value][$i]['name'], 'comment' => $_SESSION['modules_services'][$value][$i]['comment'], 'type' => $_SESSION['modules_services'][$value][$i]['servicetype'],'parent' => $value, 'system' =>$_SESSION['modules_services'][$value][$i]['system_service'] ));
+				}
+			}
+		}
+	}
+
+	/**
+	* Loads into database the services for a user group
+	*
+	* @param  $services array Array os services
+	* @param  $group string User group identifier
+	*/
+	public function load_services_db($services, $group)
+	{
+		$this->connect();
+		$this->query("delete from ".$_SESSION['tablename']['usergroup_services']." where group_id = '".$group."'");
+		for($i=0; $i<count($services);$i++)
+		{
+			$this->query("insert into ".$_SESSION['tablename']['usergroup_services']." values ('".$group."', '".$services[$i]."')");
+		}
+	}
+
+	/**
+	* Loads into session all the services for the superadmin
+	*
+	*/
+	private function get_all_services()
+	{
+		$services = array();
+		for($i=0; $i< count($_SESSION['enabled_services']);$i++)
+		{
+		//	$_SESSION['user']['services'][$_SESSION['enabled_services'][$i]['id']] = true;
+			$services[$_SESSION['enabled_services'][$i]['id']] = true;
+		}
+		return $services;
+	}
+
+	/**
+	* Loads into session all the services for a user
+	*
+	* @param  $user_id  string User identifier
+	*/
+	public function load_user_services($user_id)
+	{
+		$services = array();
+		if($user_id == "superadmin")
+		{
+			$services = $this->get_all_services();
+		}
+		else
+		{
+			$this->connect();
+			//$_SESSION['user']['services'] = array();
+			require_once($_SESSION['config']['businessapppath']."class".DIRECTORY_SEPARATOR."class_usergroups.php");
+			$group = new usergroups();
+			for($i=0; $i< count($_SESSION['enabled_services']);$i++)
+			{
+				if($_SESSION['enabled_services'][$i]['system'] == true)
+				{
+					//$_SESSION['user']['services'][$_SESSION['enabled_services'][$i]['id']] = true;
+					$services[$_SESSION['enabled_services'][$i]['id']] = true;
+				}
+				else
+				{
+					$this->query("select group_id from ".$_SESSION['tablename']['usergroup_services']." where service_id = '".$_SESSION['enabled_services'][$i]['id']."'");
+					$find = false;
+					while($res = $this->fetch_object())
+					{
+						if($group->in_group($user_id, $res->group_id) == true)
+						{
+							$find = true;
+							break;
+						}
+					}
+					if($find == true)
+					{
+						//$_SESSION['user']['services'][$_SESSION['enabled_services'][$i]['id']] = true;
+						$services[$_SESSION['enabled_services'][$i]['id']] = true;
+					}
+					else
+					{
+						//$_SESSION['user']['services'][$_SESSION['enabled_services'][$i]['id']] = false;
+						$services[$_SESSION['enabled_services'][$i]['id']] = false;
+					}
+				}
+			}
+		}
+		return $services;
+	}
+
+	/******************* COLLECTION MANAGEMENT FUNCTIONS *******************/
+
+	/**
+	* Returns all collections where we can insert new documents (with tables)
+	*
+	* @return array Collections where inserts are allowed
+	*/
+	public function retrieve_insert_collections()
+	{
+		$arr = array();
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if(isset($_SESSION['collections'][$i]['table']) && !empty($_SESSION['collections'][$i]['table']))
+			{
+				array_push($arr, $_SESSION['collections'][$i]);
+			}
+		}
+		return $arr;
+	}
+
+	/**
+	* Returns a script related to a collection
+	*
+	* @param  $coll_id  string Collection identifier
+	* @param  $script_name  string Script name "script_add", "script_search", "script_search_result", "script_details"
+	* @return string Script name or empty string if not found
+	*/
+	public function get_script_from_coll($coll_id, $script_name)
+	{
+		for($i=0; $i < count($_SESSION['collections']);$i++)
+		{
+			if(trim($_SESSION['collections'][$i]['id']) == trim($coll_id))
+			{
+				return trim($_SESSION['collections'][$i][$script_name]);
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection identifier from a table
+	*
+	* @param  $table  string Tablename
+	* @return string Collection identifier or empty string if not found
+	*/
+	public function retrieve_coll_id_from_table($table)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['table'] == $table)
+			{
+				return $_SESSION['collections'][$i]['id'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection table from a view
+	*
+	* @param  $view string View
+	* @return string Collection table or empty string if not found
+	*/
+	public function retrieve_coll_table_from_view($view)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['view'] == $view)
+			{
+				return $_SESSION['collections'][$i]['table'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection identifier from a view
+	*
+	* @param  $view string View
+	* @return string Collection identifier or empty string if not found
+	*/
+	public function retrieve_coll_id_from_view($view)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['view'] == $view)
+			{
+				return $_SESSION['collections'][$i]['id'];
+			}
+		}
+		return '';
+	}
+
+
+	/**
+	* Returns the view of a collection from the collection identifier
+	*
+	* @param string $coll_id  Collection identifier
+	* @return string View name or empty string if not found
+	*/
+	public function retrieve_view_from_coll_id($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['id'] == $coll_id)
+			{
+				return $_SESSION['collections'][$i]['view'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the view of a collection from the table of the collection
+	*
+	* @param string $table  Tablename
+	* @return string View name or empty string if not found
+	*/
+	public function retrieve_view_from_table($table)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['table'] == $table)
+			{
+				return $_SESSION['collections'][$i]['view'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the table of the collection from the collection identifier
+	*
+	* @param string $coll_id  Collection identifier
+	* @return string Table name or empty string if not found
+	*/
+	public function retrieve_table_from_coll($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['id'] == $coll_id)
+			{
+				return $_SESSION['collections'][$i]['table'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the table of the collection from the view of the collection
+	*
+	* @param string $view  View
+	* @return string Table name or empty string if not found
+	*/
+	public function retrieve_table_from_view($view)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['view'] == $view)
+			{
+				return $_SESSION['collections'][$i]['table'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection  label from the table of the collection
+	*
+	* @param string $table  Tablename
+	* @return string Collection label or empty string if not found
+	*/
+	public function retrieve_coll_label_from_table($table)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['table'] == $table)
+			{
+				return $_SESSION['collections'][$i]['label'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection  label from the collection identifier
+	*
+	* @param string $coll_id  Collection identifier
+	* @return string Collection label or empty string if not found
+	*/
+	public function retrieve_coll_label_from_coll_id($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['collections']);$i++)
+		{
+			if($_SESSION['collections'][$i]['id'] == $coll_id)
+			{
+				return $_SESSION['collections'][$i]['label'];
+			}
+		}
+		return '';
+	}
+
+	////////////////USER RELATED
+
+	/**
+	* Returns the collection identifier for the current user from the collection table (using $_SESSION['user']['security'])
+	*
+	* @param  $table  string Tablename
+	* @return string Collection identifier or empty string if not found
+	*/
+	public function retrieve_user_coll_id($table)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['table'] == $table)
+			{
+				return $_SESSION['user']['security'][$i]['coll_id'];
+			}
+		}
+		return false;
+	}
+
+	/**
+	* Return all collections where the current user can insert new documents (with table)
+	*
+	*/
+	/**
+	* Return all collections where the current user can insert new documents (with table)
+	*
+	* @return array Array of all collections where the current user can insert new documents
+	*/
+	public function retrieve_user_insert_coll()
+	{
+		$arr = array();
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if(isset($_SESSION['user']['security'][$i]['table']) && !empty(	$_SESSION['user']['security'][$i]['table']) && $_SESSION['user']['security'][$i]['can_insert'] == 'Y')
+			{
+				$ind = $this->get_ind_collection($_SESSION['user']['security'][$i]['coll_id']);
+				array_push($arr, array('coll_id'=> $_SESSION['user']['security'][$i]['coll_id'], 'label_coll' => $_SESSION['collections'][$ind]['label'] , 'table' => $_SESSION['user']['security'][$i]['table']));
+			}
+		}
+		return $arr;
+	}
+
+	/**
+	* Checks if the current user can do the action on the collection
+	*
+	* @param string $coll_id  Collection identifier
+	* @param string $action  can_insert, can_update, can_delete
+	* @return True if the user can do the action on the collection, False otherwise
+	*/
+	public function collection_user_right($coll_id, $action)
+	{
+		require_once($_SESSION['pathtocoreclass']."class_functions.php");
+		$func = new functions();
+		$flag = false;
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if(($_SESSION['user']['security'][$i]['coll_id'] == $coll_id)  && $_SESSION['user']['security'][$i][$action] == 'Y')
+			{
+				$flag = true;
+			}
+		}
+		return $flag;
+	}
+
+	/**
+	* Returns where clause of the collection for the current user from the collection identifier
+	*
+	* @param  $coll_id string Collection identifier
+	* @return string Collection where clause or empty string if not found or the where clause is empty
+	*/
+	public function get_where_clause_from_coll_id($coll_id)
+	{
+		for($i=0; $i < count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['coll_id'] == $coll_id)
+			{
+				return $_SESSION['user']['security'][$i]['where'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns where clause of the collection for the current user from the collection view
+	*
+	* @param  $view string View
+	* @return string Collection where clause or empty string if not found or the where clause is empty
+	*/
+	public function get_where_clause_from_view($view)
+	{
+		for($i=0; $i < count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['view'] == $view)
+			{
+				return $_SESSION['user']['security'][$i]['where'];
+			}
+		}
+		return '';
+	}
+
+	/**
+	* Returns the collection table for the current user from the collection view (using $_SESSION['user']['security'])
+	*
+	* @param  $table  string Tablename
+	* @return string Table name or False if not found
+	*/
+	public function retrieve_user_coll_table($view)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['view'] == $view)
+			{
+				return $_SESSION['user']['security'][$i]['table'];
+			}
+		}
+		return false;
+	}
+
+	/***************DO NOT USE THESE FUNCTIONS : DEPRECATED****************/
+	/**
+	* Returns the collection view for the current user from the collection identifier (using $_SESSION['user']['security'])
+	*
+	* @param  $coll_id  string Collection identifier
+	* @return string View name or False if not found
+	*/
+	public function retrieve_user_view_from_coll_id($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['coll_id'] == $coll_id)
+			{
+				return $_SESSION['user']['security'][$i]['view'];
+			}
+		}
+		return false;
+	}
+
+	/**
+	* Returns the collection view for the current user from the collection table (using $_SESSION['user']['security'])
+	*
+	* @param  $table  string Table name
+	* @return string View name or False if not found
+	*/
+	public function retrieve_user_view_from_table($table)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['table'] == $table)
+			{
+				return $_SESSION['user']['security'][$i]['view'];
+			}
+		}
+		return false;
+	}
+
+	/**
+	* Returns the collection table for the current user from the collection identifier (using $_SESSION['user']['security'])
+	*
+	* @param  $coll_id  string Collection identifier
+	* @return string Table name or False if not found
+	*/
+	public function retrieve_user_coll_table2($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['coll_id'] == $coll_id)
+			{
+				return $_SESSION['user']['security'][$i]['table'];
+			}
+		}
+		return false;
+	}
+
+	/**
+	* Returns the collection label for the current user from the collection table (using $_SESSION['user']['security'])
+	*
+	* @param  $table  string Table name
+	* @return string Collection label or False if not found
+	*/
+	public function retrieve_user_coll_label($table)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['table'] == $table)
+			{
+				return $_SESSION['user']['security'][$i]['label_coll'];
+			}
+		}
+		return false;
+	}
+
+	/**
+	* Returns the collection label for the current user from the collection identifier (using $_SESSION['user']['security'])
+	*
+	* @param  $coll_id  string Collection identifier
+	* @return string Collection label or False if not found
+	*/
+	public function retrieve_user_coll_label2($coll_id)
+	{
+		for($i=0; $i<count($_SESSION['user']['security']);$i++)
+		{
+			if($_SESSION['user']['security'][$i]['coll_id'] == $coll_id)
+			{
+				return $_SESSION['user']['security'][$i]['label_coll'];
+			}
+		}
+		return false;
+	}
+	/*********************************************/
+
+	/**
+	* Checks the right on the document of a collection for the current user
+	*
+	* @param  $coll_id string Collection identifier
+	* @param  $s_id string Document Identifier (res_id)
+	* @return bool True if the current user has the right, False otherwise
+	*/
+	public function test_right_doc($coll_id, $s_id)
+	{
+		if(empty($coll_id) || empty($s_id))
+		{
+			return false;
+		}
+		$view = $this->retrieve_view_from_coll_id($coll_id);
+		if(empty($view))
+		{
+			$view = $this->retrieve_table_from_coll($coll_id);
+		}
+		$where_clause = $this->get_where_clause_from_coll_id($coll_id);
+
+		$query = "select res_id from ".$view." where res_id = ".$s_id;
+
+		if(!empty($where_clause))
+		{
+			$query .= " and (".$where_clause.") ";
+		}
+		$this->connect();
+		$this->query($query);
+
+		if($this->nb_result() < 1)
+		{
+			return false;
+		}
+		else
+		{
+			return true;
+		}
+	}
+
+	/**
+	* Process a where clause, using the process_where_clause methods of the modules, the core and the apps
+	*
+	* @param  $where_clause string Where clause to process
+	* @param  $user_id string User identifier
+	* @return string Proper where clause
+	*/
+	public function process_security_where_clause($where_clause, $user_id)
+	{
+		if(!empty($where_clause))
+		{
+			$where = ' where '.$where_clause;
+
+			// Process with the core vars
+			$where = $this->process_where_clause($where, $user_id);
+
+			require_once($_SESSION['pathtocoreclass']."class_request.php");
+			// Process with the modules vars
+			foreach(array_keys($_SESSION['modules_loaded']) as $key)
+			{
+				$path_module_tools = $_SESSION['modules_loaded'][$key]['path']."class".DIRECTORY_SEPARATOR."class_modules_tools.php";
+				require_once($path_module_tools);
+				$object = new $key;
+				if(method_exists($object, 'process_where_clause'))
+				{
+					$where = $object->process_where_clause($where, $user_id);
+				}
+			}
+			$where = preg_replace('/, ,/', ',', $where);
+			$where = preg_replace('/\( ?,/', '(', $where);
+			$where = preg_replace('/, ?\)/', ')', $where);
+
+			// Process with the apps vars
+			require_once($_SESSION['config']['businessapppath'].'class'.DIRECTORY_SEPARATOR.'class_business_app_tools.php');
+			$object = new business_app_tools();
+			if(method_exists($object, 'process_where_clause'))
+			{
+				$where = $object->process_where_clause($where, $user_id);
+			}
+			return $where;
+		}
+		else
+		{
+			return '';
+		}
+	}
+
+	/**
+	* Process a where clause with the core specific vars
+	*
+	* @param  $where_clause string Where clause to process
+	* @param  $user_id string User identifier
+	* @return string Proper where clause
+	*/
+	public function process_where_clause($where_clause, $user_id)
+	{
+		$where = $where_clause;
+		if(preg_match('/@user/', $where_clause))
+		{
+			$where = str_replace("@user","'".trim($user_id)."'", $where_clause);
+		}
+		return $where;
+	}
+}
+?>
diff --git a/core/trunk/core/manage_action.php b/core/trunk/core/manage_action.php
new file mode 100644
index 00000000000..763876c7373
--- /dev/null
+++ b/core/trunk/core/manage_action.php
@@ -0,0 +1,283 @@
+<?php
+/*
+*    Copyright 2008,2009 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/>.
+*/
+
+/**
+* @brief   Manage core actions
+*
+* @file
+* @author Claire Figueras <dev@maarch.org>
+* @date $date$
+* @version $Revision$
+* @ingroup core
+*/
+session_name('PeopleBox');
+session_start();
+
+require_once($_SESSION['pathtocoreclass']."class_functions.php");
+require_once($_SESSION['pathtocoreclass']."class_db.php");
+require_once($_SESSION['pathtocoreclass']."class_core_tools.php");
+
+$db = new dbquery();
+$core = new core_tools();
+$core->load_lang();
+$res_action = array();
+
+/**
+* Puts the values that are in a string into an array.
+* $$ field separator, # field_name / value separator
+*
+* @param $val string Values to split
+* @return array Values in array
+**/
+function get_values_in_array($val)
+{
+	$tab = explode('$$',$val);
+	$values = array();
+	for($i=0; $i<count($tab);$i++)
+	{
+		$tmp = explode('#', $tab[$i]);
+		array_push($values, array('ID' => $tmp[0], 'VALUE' => trim($tmp[1])));
+	}
+	return $values;
+}
+
+// Form validation
+if($_POST['req'] == 'valid_form' && !empty($_POST['action_id']) && isset($_POST['action_id']) && !empty($_POST['form_to_check'])&& isset($_POST['form_to_check']))
+{
+	$id_action = $_POST['action_id'];
+	$db->connect();
+	// Gets the action informations from the database
+	$db->query("select * from ".$_SESSION['tablename']['actions']." where id = ".$id_action);
+
+	if($db->nb_result() < 1)
+	{
+		$_SESSION['action_error'] = _ACTION_NOT_IN_DB;
+		echo "{status : 5, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+		exit();
+	}
+
+	$res = $db->fetch_object();
+	$label_action = $res->label_action;
+	$status = $res->id_status;
+	$action_page = $res->action_page;
+	$bool_history = $res->history;
+	$create_id = $res->create_id;
+
+		//No script defined for this action
+	if($action_page == '')
+	{
+		$_SESSION['action_error'] = _ACTION_NOT_IN_DB;
+		echo "{status : 5, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+		exit();
+	}
+
+	$path_action_page = $core->get_path_action_page($action_page);
+	// Invalid path to script
+	if(!file_exists($path_action_page))
+	{
+		$_SESSION['action_error'] = $label_action.' '._ACTION_PAGE_MISSING;
+		echo "{status : 8, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+		exit();
+	}
+
+	// If no error, includes script file and checks the form
+	include($path_action_page);
+	$frm_error = check_form(trim($_POST['form_to_check']),get_values_in_array($_POST['form_values']));
+	if($frm_error == false)
+	{
+		echo "{status : 1, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+		exit();
+	}
+	else
+	{
+		if($create_id == 'N')
+		{
+			echo "{status : 0, error_txt : '".addslashes($_SESSION['action_error'])."', page_result : '', manage_form_now : false}";
+		}
+		else
+		{
+			echo "{status : 0, error_txt : '".addslashes($_SESSION['action_error'])."', page_result : '', manage_form_now : true}";
+		}
+		exit();
+	}
+}
+// Post variables error
+else if(empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST['action_id']) ||
+($_POST['mode'] <> 'mass' && $_POST['mode'] <> 'page')  || empty($_POST['table'])
+|| empty($_POST['coll_id']) || empty($_POST['module']) || ($_POST['req'] <> 'first_request' && $_POST['req'] <> 'second_request'))
+{
+	$tmp = 'values : '.$_POST['values'].', action_id : '.$_POST['action_id'].', mode : '. $_POST['mode'].', table : '.$_POST['table'].', coll_id : '.$_POST['coll_id'].', module : '.$_POST['module'].', req : '.$_POST['req'];
+	$_SESSION['action_error'] = $tmp._AJAX_PARAM_ERROR;
+	echo "{status : 1, error_txt : '".$id_action.addslashes($_SESSION['action_error'])."'}";
+	exit();
+}
+else
+{
+	// Puts the res_id into an array
+	$arr_id = explode(',', $_POST['values']);
+	$id_action = $_POST['action_id'];
+	$db->connect();
+	// Gets the action informations from the database
+	$db->query("select * from ".$_SESSION['tablename']['actions']." where id = ".$id_action);
+
+	if($db->nb_result() < 1)
+	{
+		$_SESSION['action_error'] = _ACTION_NOT_IN_DB;
+		echo "{status : 5, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+		exit();
+	}
+
+	$res = $db->fetch_object();
+	$label_action = $res->label_action;
+	$status = $res->id_status;
+	$action_page = $res->action_page;
+	$bool_history = $res->history;
+
+	//No script defined for this action
+	if($action_page == '')
+	{
+		//If second request : Error
+		if($_POST['req'] == 'second_request')
+		{
+			$_SESSION['action_error'] = _ACTION_NOT_IN_DB;
+			echo "{status : 5, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+			exit();
+		}
+
+		//If no status defined in the action file , error
+		if($status == '' || $status == 'NONE')
+		{
+			$_SESSION['action_error'] = $label_action.' : '._ERROR_PARAM_ACTION;
+			echo "{status : 6, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+			exit();
+		}
+
+		// Update the status
+		$result = '';
+		for($i=0; $i<count($arr_id );$i++)
+		{
+			$arr_id[$i] = str_replace('#', '', $arr_id[$i]);
+			$result .= $arr_id[$i].'#';
+			$query_str = "update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i];
+			$req = $db->query($query_str, true);
+			if(!$req)
+			{
+				$_SESSION['action_error'] = _SQL_ERROR.' : '.$query_str;
+				echo "{status : 7, error_txt : '".addslashes($label_action.' : '.$_SESSION['action_error'])."'}";
+				exit();
+			}
+		}
+		$res_action = array('result' => $result, 'history_msg' => '');
+		$_SESSION['action_error'] = _ACTION_DONE.' : '.$label_action;
+		echo "{status : 0, error_txt : '".addslashes($_SESSION['action_error']).", status : ".$status.", ".$_POST['values']."', page_result	: ''}";
+
+	}
+	// There is a script for the action
+	else
+	{
+		$path_action_page = $core->get_path_action_page($action_page);
+
+		// Invalid path to the action script
+		if(!file_exists($path_action_page))
+		{
+			$_SESSION['action_error'] = $label_action.' '._ACTION_PAGE_MISSING.$path_action_page;
+			echo "{status : 8, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+			exit();
+		}
+
+		// Include the action file
+		include($path_action_page);
+		if($_POST['req'] == 'first_request' && in_array('form', $etapes))
+		{
+			$frm_test = get_form_txt($arr_id, $_SESSION['config']['coreurl'].'core/manage_action.php', $id_action, $_POST['table'],$_POST['module'], $_POST['coll_id'],  $_POST['mode'] );
+			echo "{status : 3, form_content : '".$frm_test."', height : '".$frm_height."', width : '".$frm_width."', 'mode_frm' : '".$mode_form."'}";
+			exit();
+		}
+		elseif( $_POST['req'] == 'first_request' && $confirm == true)
+		{
+			echo "{status : 2, confirm_content : '".addslashes(_ACTION_CONFIRM." ".$label_action)."', validate : '"._VALIDATE."', cancel : '"._CANCEL."', label_action : '".addslashes($label_action)."'}";
+			exit();
+		}
+		else
+		{
+			$_SESSION['action_error'] = $label_action.' : '._ERROR_SCRIPT;
+			for($i=0; $i<count($etapes);$i++)
+			{
+				if( function_exists('manage_'.$etapes[$i]))
+				{
+					try
+					{
+						if($_POST['req'] == 'second_request')
+						{
+							$res_action = call_user_func('manage_'.$etapes[$i],$arr_id, $bool_history, $id_action, $label_action, $status, $_POST['coll_id'], $_POST['table'], get_values_in_array($_POST['form_values'])  );
+						}
+						else
+						{
+							$res_action = call_user_func('manage_'.$etapes[$i],$arr_id, $bool_history, $id_action, $label_action, $status, $_POST['coll_id'], $_POST['table']);
+						}
+					}
+					catch(Exception $e)
+					{
+						echo "{status : 9, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+						exit();
+					}
+				}
+				else
+				{
+					echo "{status : 9, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+					exit();
+				}
+			}
+			if($res_action == false)
+			{
+				echo "{status : 9, error_txt : '".addslashes($_SESSION['action_error'])."'}";
+				exit();
+			}
+			$comp = ", page_result	: ''";
+			if(isset($res_action['page_result']) && !empty($res_action['page_result']))
+			{
+				$comp = ", page_result	: '".$res_action['page_result']."'";
+			}
+			$_SESSION['action_error'] = _ACTION_DONE.' : '.$label_action;
+			echo "{status : 0, error_txt : '".addslashes($_SESSION['action_error'])."'".$comp.", result_id : '".$res_action['result']."'}";
+		}
+	}
+	// Save action in history if needed
+	if($bool_history=='Y')
+	{
+		require_once($_SESSION['pathtocoreclass']."class_history.php");
+		$hist = new history();
+		$arr_res = explode('#', $res_action['result']);
+		for($i=0; $i<count($arr_res );$i++)
+		{
+			if(!empty($arr_res[$i]))
+			{
+				$what = $label_action.'('._NUM.$arr_res[$i].') ';
+				if(isset($res_action['history_msg']) && !empty($res_action['history_msg']))
+				{
+					$what .= $res_action['history_msg'];
+				}
+				$hist->add($_POST['table'],$arr_res[$i],'ACTION#'.$id_action,$what, $_SESSION['config']['databasetype'], $_POST['module']);
+			}
+		}
+	}
+	exit();
+}
+?>
diff --git a/core/trunk/core/sql/data/core.mysql.sql b/core/trunk/core/sql/data/core.mysql.sql
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/core/trunk/core/sql/data/core.oracle.sql b/core/trunk/core/sql/data/core.oracle.sql
new file mode 100644
index 00000000000..76bed0f6081
--- /dev/null
+++ b/core/trunk/core/sql/data/core.oracle.sql
@@ -0,0 +1,176 @@
+INSERT INTO docservers VALUES ('documents', NULL, NULL, 'N', 'Y', 1000000000, 17890777, 'C:\\\\Maarch\\\\DocServer\\\\res_x\\\\', NULL, NULL, NULL, TO_DATE('2007-11-19 11:41:22', 'YYYY-MM-DD HH24:MI:SS'), NULL, 'coll_1', 10);
+INSERT INTO docservers VALUES ('documents_ai', NULL, NULL, 'N', 'Y', 1000000000, 17890777, 'C:\\\\Maarch\\\\DocServer\\\\res_x_ai\\\\', NULL, NULL, NULL, TO_DATE('2007-11-19 11:41:22', 'YYYY-MM-DD HH24:MI:SS'), NULL, 'coll_1', 20);
+INSERT INTO docservers VALUES ('invoices', NULL, NULL, 'N', 'Y', 100000000, 3271717, 'C:\\\\Maarch\\\\DocServer\\\\res_invoices\\\\', NULL, NULL, NULL, TO_DATE('2007-11-19 11:41:22', 'YYYY-MM-DD HH24:MI:SS'), NULL, 'coll_2', 10);
+INSERT INTO docservers VALUES ('invoices_ai', NULL, NULL, 'N', 'Y', 100000000, 3271717, 'C:\\\\Maarch\\\\DocServer\\\\res_invoices_ai\\\\', NULL, NULL, NULL, TO_DATE('2007-11-19 11:41:22', 'YYYY-MM-DD HH24:MI:SS'), NULL, 'coll_2', 20);
+
+INSERT INTO doctypes VALUES ('coll_1', 1, 'Carte de securite sociale - Social security card', 'Y', 1, 1, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 2, 'Passeport - Passport', 'Y', 1, 1, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N', NULL );
+INSERT INTO doctypes VALUES ('coll_1', 3, 'Devis - Loan proposal', 'Y', 1, 3, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 4, 'Demande de prelevement FMG - FMG agreement', 'Y', 1, 3, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 5, 'Bulletins de salaire - Salary sheets', 'Y', 1, 2, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N', NULL );
+INSERT INTO doctypes VALUES ('coll_1', 6, 'Interrogation BDF - BDF query', 'Y', 1, 2, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 7, 'Releves de compte - Bank listings', 'Y', 1, 2, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 8, 'Situation financiere - Financial situation', 'Y', 1, 2, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N', NULL );
+INSERT INTO doctypes VALUES ('coll_1', 9, 'Fiche d etude de compte - Bank listing memo', 'Y', 1, 2, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_1', 10, 'Fiche de liaison - Loan memo', 'Y', 1, 3, NULL, '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+INSERT INTO doctypes VALUES ('coll_2', 22, 'Facture - Customer Invoice', 'Y', 1, 1, NULL, '1000000000', '1000000000', '0000000000', '0000000000', '1000000000', '0000000000', '0000000000', '0000000000', '1000000000', '0000000000', '0000000000', '0000000000', '1000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', 'N',  NULL );
+
+INSERT INTO parameters VALUES ('workbatch_rec', '', 7);
+INSERT INTO parameters VALUES ('folder_id_increment', '', 152);
+INSERT INTO parameters VALUES ('work_batch_autoimport_id', NULL, 1);
+
+INSERT INTO security VALUES ('Recovery', 'coll_2', ' ', '', 'Y', 'Y', 'N');
+INSERT INTO security VALUES ('Recovery', 'coll_1', ' ', '', 'Y', 'Y', 'N');
+INSERT INTO security VALUES ('Accountants', 'coll_2', ' ', '', 'Y', 'Y', 'N');
+
+INSERT INTO usergroups VALUES ('Recovery', 'Recovery - Recouvrement', 'N', 'N', 'N', 'N', 'N', 'Y');
+INSERT INTO usergroups VALUES ('Admin', 'Administration', 'N', 'N', 'N', 'N', 'N', 'Y');
+INSERT INTO usergroups VALUES ('Accountants', 'Accountants - Comptables', 'N', 'N', 'N', 'N', 'N', 'Y');
+INSERT INTO usergroups VALUES ('Managers', 'Customer managers - Gestionnaires de comptes', 'N', 'N', 'N', 'N', 'N', 'Y');
+
+INSERT INTO usergroup_content (user_id, group_id, primary_group, role) VALUES ('pparker', 'Recovery', 'Y', 'Service manager');
+INSERT INTO usergroup_content (user_id, group_id, primary_group, role) VALUES ('ccharles', 'Accountants', 'Y', 'Clerck');
+INSERT INTO usergroup_content (user_id, group_id, primary_group, role) VALUES ('bsaporta', 'Managers', 'Y', 'Account manager');
+
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('pparker', 'ef9689be896dacd901cae4f13593e90d', 'Peter', 'Parker', '+33 1 47 24 51 ', 'info@maarch.org', 'Financial - DFI', NULL, NULL, NULL, '50b29715235ee7204c22cbd4b59a3e42', TO_DATE('2008-09-10 15:09:22', 'YYYY-MM-DD HH24:MI:SS'), 'Y', 'N', NULL, 'OK');
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ccharles', 'ef9689be896dacd901cae4f13593e90d', 'Charlotte', 'Charles', '+33 1 47 24 51 ', 'info@maarch.org', 'Accounting department - DFI', NULL, NULL, NULL, '2b67f8017119d7de32f300be3e97ccb4',  TO_DATE('2008-09-10 15:09:23', 'YYYY-MM-DD HH24:MI:SS'), 'Y', 'N', NULL, 'OK');
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bsaporta', 'ef9689be896dacd901cae4f13593e90d', 'Barbara', 'Saporta', '+33 1 47 24 51 ', 'info@maarch.org', 'Sales - Commercial', NULL, NULL, NULL, '35286c2c7b64e9ae8dc1d88ef78814d4', TO_DATE('2008-09-10 15:09:23', 'YYYY-MM-DD HH24:MI:SS'), 'Y', 'N', NULL, 'OK');
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('superadmin', '17c4520f6cfd1ab53d8745e84681eb49', 'Super', 'Admin', '', 'admin@maarch.org', 'Maarch', '1', NULL, NULL, '5a12d1199eccb57fded2a232df35cb4b', TO_DATE('2009-05-07 17:05:46', 'YYYY-MM-DD HH24:MI:SS'), 'Y', 'N', NULL, 'OK');
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('bblier', 'ef9689be896dacd901cae4f13593e90d', 'Bernard', 'Blier', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '', NULL, 'Y', 'Y', NULL, 'OK');
+INSERT INTO users (user_id, password, firstname, lastname, phone, mail, department, custom_t1, custom_t2, custom_t3, cookie_key, cookie_date, enabled, change_password, delay, status) VALUES ('ppetit', 'ef9689be896dacd901cae4f13593e90d', 'Patricia', 'Petit', '+33 1 47 24 51 ', 'info@maarch.org', '', NULL, NULL, NULL, '', NULL, 'Y', 'Y', NULL, 'OK');
+
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', '_print_sep');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_architecture');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_foldertypes');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_groups');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_tree_autofoldering');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'admin_users');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'adv_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'delete_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'delete_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'folder_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'indexing');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'launch_workflow');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'modify_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'modify_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'physical_archive');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'physical_archive_box_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'physical_archive_box_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'view_attached_files');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'view_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'view_trees');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Accountants', 'view_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', '_print_sep');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_architecture');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_foldertypes');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_groups');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_tree_autofoldering');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'admin_users');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'adv_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'create_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'delete_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'delete_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'folder_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'index_file');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'index_file2');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'indexing');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'modify_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'modify_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'physical_archive');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'physical_archive_box_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'physical_archive_box_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'physical_archive_lot_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'physical_archive_lot_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'salary_sheet');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'select_doctype');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'select_doctype2');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'select_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'show_contract_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'show_history_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'show_missing_doc_in_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'use_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'view_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'view_stats');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Admin', 'view_trees');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', '_print_sep');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_architecture');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_foldertypes');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_groups');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_tree_autofoldering');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'admin_users');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'adv_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'delete_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'delete_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'folder_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'indexing');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'modify_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'modify_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'physical_archive');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'physical_archive_batch_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'physical_archive_batch_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'physical_archive_box_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'physical_archive_box_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'view_attached_files');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'view_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Managers', 'view_trees');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', '_print_sep');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_architecture');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_foldertypes');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_groups');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_tree_autofoldering');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'admin_users');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'adv_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'create_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'delete_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'delete_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'folder_search');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'index_file');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'index_file2');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'indexing');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'modify_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'modify_res');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'physical_archive');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'physical_archive_box_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'physical_archive_box_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'physical_archive_lot_manage');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'physical_archive_lot_read');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'salary_sheet');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'select_doctype');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'select_doctype2');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'select_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'show_contract_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'show_history_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'show_missing_doc_in_folder');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'use_baskets');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'view_history');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'view_stats');
+INSERT INTO usergroups_services (group_id, service_id) VALUES ('Recovery', 'view_trees');
+
+INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin) VALUES (2,'to_validate', 'A valider', 'VAL', 'Y', 'N', 'confirm_status', 'N', 'apps');
+INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin) VALUES (4,'', 'Valider Facture', 'END', 'N', 'Y', 'confirm_status', 'Y','apps');
+INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin) VALUES (5,'', 'Rejeter Facture', 'REJ', 'N', 'Y', 'confirm_status', 'Y', 'apps');
+INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin) VALUES (6,'', 'Verifier facture', '', 'N', 'Y', 'check_invoice_action', 'Y', 'apps');
+INSERT INTO actions (id, keyword, label_action, id_status, is_system, enabled, action_page, history, origin) VALUES (14,'', 'Reserver', 'RSV', 'N', 'Y', 'doc_list', 'Y', 'apps');
+
+
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('COU', 'En cours', 'Y', NULL, 'indexing_searching', 'Y');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('NEW', 'nouveau courrier', 'Y', '', 'apps', 'Y');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('RSV', 'Reserve', 'N', '', 'apps', 'N');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('DEL', 'Supprime', 'Y', NULL, 'apps', 'N');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('END', 'Valide', 'Y', NULL, 'indexing_searching', 'Y');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('VAL', 'A valider', 'Y', NULL, 'apps', 'N');
+INSERT INTO status (id, label_status, is_system, img_filename, maarch_module, can_be_searched) VALUES ('REJ', 'Rejete', 'N', '', 'apps', 'Y');
+
+
+
+
+
+
diff --git a/core/trunk/core/sql/data/core.postgresql.sql b/core/trunk/core/sql/data/core.postgresql.sql
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/core/trunk/core/sql/structure/core.mssql.sql b/core/trunk/core/sql/structure/core.mssql.sql
new file mode 100644
index 0000000000000000000000000000000000000000..7ef29b68a02611c6fa9ff47d5f8c1f67502dda54
GIT binary patch
literal 103854
zcmeI5ZEqaOjezIt1-Sp9Z(bjQz_w&rLN14sWofg?CQjDg%LR*tU|Y7=S*@)|vv2wF
zcgLqWR8@5sySw_$3T|M?wxp>di$$_X7RmbG|9Q4LSv_Cvtd3THTs>QTwmOr4zg&GT
zf1b%tpUQXty86ZHQ~4kN+Nb|4pLr_dPF7E3#AovNiG1?8{O?r0PF7!J#`3!z`4r=J
z<TL**pL{0&2hJze%%96okE`GQoBZrlW_h~$gZ%G$^|O5aYV~3Da`m^>>(#5(TE5>|
z{blvr3f77IKmOg>>fP#Ge)b#rdb)bN`rT$;#q<-w;m+zS`NT^Z^|j3V)#`hh@Ac|x
z^;W(<$ak0W{nzrTyD|fmc_RO=1&d4h)Q-&lUjEj3zN|iVx1!Etf%B=XN@;d1_@BsV
zsI()09|<O`aHkjSPpTRJMLrvF(sg}Z&G5tOh2Z*X^-cBf*MiON>OqCCQP}qJm)V)l
zWhK`#-ka^g>Y@B${Wi}|wacfn4)}vTgaXPdcUJ+*3!&_H6^-5rgtcJ#LjL|B|0=8)
z=lfZVbCB)`EcPS7c~$KiGk+&McqI_u3N_ZN`wPK&un?Txh2ZQ>4Cl2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R@-
z+~{tZHH#)Ux?5h&rpb*C=d_Qx$8XpyUAty>O%rx(*LbkavdN9^rkdF{xzXKJGwUWd
zx|?cd-{eMjQ!Tb|K5iu6VxvTK^wgOup3iJ*&zjxlM-BNT(Zc)~FK)*uVtr}!*lrHC
zw+Gh}>)vti50GrT1<A)++akPnOHvx+&E0zBp?kZY-qMuEdJThL%WZ((oe+1on-FMn
z+wV<2NY?q^B<f8({<_Bf@$X_vJ(b==zuRQW>kZE*veG+MpV*Ld|3<Q`>4-oszjgrO
z#w2ixN%BsW>&^Wcb9@=ytI*--Q@MB2s>3wX|G9A7<0@ajp6lO)8!GRb)t<vDitX-_
z{nyGE%~$9D!`_)QDs@-rVO!*SNaU*lkE?sSv?91pA^bgVLBN5(bw!5J*P=<`>fyCJ
TO{&+caO?E^m=!%^x)b~#bYGGW

literal 0
HcmV?d00001

diff --git a/core/trunk/core/sql/structure/core.mysql.sql b/core/trunk/core/sql/structure/core.mysql.sql
new file mode 100644
index 00000000000..7becf71daf8
--- /dev/null
+++ b/core/trunk/core/sql/structure/core.mysql.sql
@@ -0,0 +1,222 @@
+CREATE TABLE actions(
+id bigint( 8 ) NOT NULL AUTO_INCREMENT ,
+keyword varchar( 32) NOT NULL DEFAULT '' ,
+label_action varchar( 255 ) ,
+id_status varchar( 10 ) ,
+is_system char(1) NOT NULL DEFAULT 'N',
+enabled char(1) NOT NULL DEFAULT 'Y',
+action_page varchar( 255 ) ,
+history char(1) NOT NULL DEFAULT 'N',
+origin varchar( 255 ) NOT NULL DEFAULT 'apps',
+create_id char(1) NOT NULL DEFAULT 'N',
+PRIMARY KEY ( id )
+)ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE docservers (
+  docserver_id varchar(32) collate utf8_unicode_ci NOT NULL default '1',
+  device_type varchar(32) collate utf8_unicode_ci default NULL,
+  device_label varchar(255) collate utf8_unicode_ci default NULL,
+  is_readonly char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  size_limit int(8) NOT NULL default '0',
+  actual_size int(8) NOT NULL default '0',
+  path_template varchar(255) collate utf8_unicode_ci NOT NULL,
+  ext_docserver_info varchar(255) collate utf8_unicode_ci default NULL,
+  chain_before varchar(32) collate utf8_unicode_ci default NULL,
+  chain_after varchar(32) collate utf8_unicode_ci default NULL,
+  creation_date datetime NOT NULL,
+  closing_date datetime default NULL,
+  coll_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  priority int(8) NOT NULL default '10',
+  PRIMARY KEY  (docserver_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS doctypes (
+  coll_id varchar(32) collate utf8_unicode_ci NOT NULL default '',
+  type_id int(8) NOT NULL auto_increment,
+  description varchar(255) collate utf8_unicode_ci NOT NULL default '',
+  enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  doctypes_first_level_id int(8) default NULL,
+  doctypes_second_level_id int(8) default NULL,
+  primary_retention varchar(50) collate utf8_unicode_ci default NULL,
+  secondary_retention varchar(50) collate utf8_unicode_ci default NULL,
+  custom_t1 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_n1 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_f1 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d1 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t2 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_n2 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_f2 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d2 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t3 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_n3 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_f3 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d3 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t4 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_n4 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_f4 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d4 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t5 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_n5 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_f5 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d5 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t6 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d6 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t7 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d7 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t8 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d8 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t9 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d9 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t10 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_d10 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t11 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t12 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t13 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t14 varchar(10) collate utf8_unicode_ci default '0000000000',
+  custom_t15 varchar(10) collate utf8_unicode_ci default '0000000000',
+  is_master char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  PRIMARY KEY  (type_id)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci  ;
+
+CREATE TABLE IF NOT EXISTS ext_docserver (
+  doc_id varchar(255) collate utf8_unicode_ci NOT NULL,
+  path varchar(255) collate utf8_unicode_ci NOT NULL,
+  PRIMARY KEY  (doc_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE `fulltext` (
+`coll_id` VARCHAR( 32 ) NOT NULL ,
+`res_id` INT( 20 ) NOT NULL ,
+`text_type` VARCHAR( 10 ) NOT NULL DEFAULT 'CON',
+`fulltext_content` TEXT NOT NULL ,
+PRIMARY KEY ( `coll_id` , `res_id` )
+) ENGINE = MYISAM ;
+
+CREATE TABLE IF NOT EXISTS groupsecurity (
+  group_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  resgroup_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  can_view char(1) collate utf8_unicode_ci NOT NULL,
+  can_add char(1) collate utf8_unicode_ci NOT NULL,
+  can_delete char(1) collate utf8_unicode_ci NOT NULL,
+  PRIMARY KEY  (group_id,resgroup_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS history (
+  id int(8) NOT NULL auto_increment,
+  table_name varchar(32) collate utf8_unicode_ci default NULL,
+  record_id varchar(255) collate utf8_unicode_ci default NULL,
+  event_type varchar(32) collate utf8_unicode_ci NOT NULL,
+  user_id varchar(50) collate utf8_unicode_ci NOT NULL,
+  event_date datetime NOT NULL,
+  info text collate utf8_unicode_ci,
+  id_module varchar(50) collate utf8_unicode_ci NOT NULL default 'admin',
+  remote_ip varchar(32) collate utf8_unicode_ci default NULL,
+  PRIMARY KEY  (id)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
+
+CREATE TABLE IF NOT EXISTS history_batch (
+  id int(8) NOT NULL auto_increment,
+  module_name varchar(32) collate utf8_unicode_ci default NULL,
+  batch_id int(8) default NULL,
+  event_date datetime NOT NULL,
+  total_processed int(8) default NULL,
+  total_errors int(8) default NULL,
+  info text collate utf8_unicode_ci,
+  PRIMARY KEY  (id)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
+
+
+CREATE TABLE IF NOT EXISTS parameters (
+  id varchar(50) collate utf8_unicode_ci NOT NULL,
+  param_value_string varchar(50) collate utf8_unicode_ci default NULL,
+  param_value_int int(8) default NULL,
+  PRIMARY KEY  (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS resgroup_content (
+  coll_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  res_id int(8) NOT NULL,
+  resgroup_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  sequence int(8) NOT NULL,
+  PRIMARY KEY  (coll_id,res_id,resgroup_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS resgroups (
+  resgroup_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  resgroup_desc varchar(255) collate utf8_unicode_ci NOT NULL,
+  created_by varchar(255) collate utf8_unicode_ci NOT NULL,
+  creation_date datetime NOT NULL,
+  PRIMARY KEY  (resgroup_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS security (
+  group_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  coll_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  where_clause varchar(255) collate utf8_unicode_ci default NULL,
+  maarch_comment text collate utf8_unicode_ci,
+  can_insert char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  can_update char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  can_delete char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  PRIMARY KEY  (group_id,coll_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE status
+(
+  id varchar(10) NOT NULL,
+  label_status varchar(50) NOT NULL,
+  is_system  char(1) NOT NULL DEFAULT 'Y',
+  img_filename varchar(255),
+  maarch_module varchar(255) NOT NULL DEFAULT 'apps',
+  can_be_searched  char(1) NOT NULL DEFAULT 'Y',
+  can_be_modified  char(1) NOT NULL DEFAULT 'Y',
+ PRIMARY KEY (id)
+)ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS usergroup_content (
+  user_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  group_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  primary_group char(1) collate utf8_unicode_ci NOT NULL,
+  role varchar(255) collate utf8_unicode_ci default NULL,
+  PRIMARY KEY  (user_id,group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS usergroups (
+  group_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  group_desc varchar(255) collate utf8_unicode_ci default NULL,
+  administrator char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  custom_right1 char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  custom_right2 char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  custom_right3 char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  custom_right4 char(1) collate utf8_unicode_ci NOT NULL default 'N',
+  enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  PRIMARY KEY  (group_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS usergroups_services (
+  group_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  service_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  PRIMARY KEY  (group_id,service_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE IF NOT EXISTS users (
+  user_id varchar(32) collate utf8_unicode_ci NOT NULL,
+  password varchar(255) collate utf8_unicode_ci default NULL,
+  firstname varchar(255) collate utf8_unicode_ci default NULL,
+  lastname varchar(255) collate utf8_unicode_ci default NULL,
+  phone varchar(15) collate utf8_unicode_ci default NULL,
+  mail varchar(255) collate utf8_unicode_ci default NULL,
+  department varchar(50) collate utf8_unicode_ci default NULL,
+  custom_t1 varchar(50) collate utf8_unicode_ci default NULL,
+  custom_t2 varchar(50) collate utf8_unicode_ci default NULL,
+  custom_t3 varchar(50) collate utf8_unicode_ci default NULL,
+  cookie_key varchar(255) collate utf8_unicode_ci default NULL,
+  cookie_date datetime default NULL,
+  enabled char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  change_password char(1) collate utf8_unicode_ci NOT NULL default 'Y',
+  delay datetime default NULL,
+  status varchar(10) NOT NULL DEFAULT 'OK',
+  PRIMARY KEY  (user_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+
diff --git a/core/trunk/core/sql/structure/core.oracle.sql b/core/trunk/core/sql/structure/core.oracle.sql
new file mode 100644
index 00000000000..711bb4caad4
--- /dev/null
+++ b/core/trunk/core/sql/structure/core.oracle.sql
@@ -0,0 +1,321 @@
+--------------------------------------------------------
+--  DDL for Table ACTIONS
+--------------------------------------------------------
+
+  CREATE TABLE "ACTIONS"
+   (	"ID" NUMBER NOT NULL ENABLE,
+	"KEYWORD" VARCHAR2(32 CHAR) DEFAULT NULL,
+	"LABEL_ACTION" VARCHAR2(255 CHAR),
+	"ID_STATUS" VARCHAR2(10 CHAR),
+	"IS_SYSTEM" VARCHAR2(1 CHAR) DEFAULT 'N' NOT NULL ENABLE,
+	"ENABLED" VARCHAR2(1 CHAR) DEFAULT 'Y' NOT NULL ENABLE,
+	"ACTION_PAGE" VARCHAR2(255 CHAR),
+	"HISTORY" VARCHAR2(1 CHAR) DEFAULT 'N' NOT NULL ENABLE,
+	"ORIGIN" VARCHAR2(255 CHAR) DEFAULT 'apps' NOT NULL ENABLE,
+	"CREATE_ID" VARCHAR2(1 CHAR) DEFAULT 'N' NOT NULL ENABLE,
+	 CONSTRAINT "ACTIONS_PK" PRIMARY KEY ("ID") ENABLE
+   ) ;
+
+  CREATE TABLE "DOCSERVERS"
+   (	"DOCSERVER_ID" VARCHAR2(32) DEFAULT '1',
+	"DEVICE_TYPE" VARCHAR2(32) DEFAULT NULL,
+	"DEVICE_LABEL" VARCHAR2(255) DEFAULT NULL,
+	"IS_READONLY" VARCHAR2(1) DEFAULT 'N',
+	"ENABLED" VARCHAR2(1) DEFAULT 'Y',
+	"SIZE_LIMIT" NUMBER DEFAULT '0',
+	"ACTUAL_SIZE" NUMBER DEFAULT '0',
+	"PATH_TEMPLATE" VARCHAR2(255) NOT NULL ENABLE,
+	"EXT_DOCSERVER_INFO" VARCHAR2(255) DEFAULT NULL,
+	"CHAIN_BEFORE" VARCHAR2(32) DEFAULT NULL,
+	"CHAIN_AFTER" VARCHAR2(32) DEFAULT NULL,
+	"CREATION_DATE" DATE DEFAULT sysdate,
+	"CLOSING_DATE" DATE DEFAULT sysdate,
+	"COLL_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"PRIORITY" NUMBER DEFAULT '10',
+	 PRIMARY KEY ("DOCSERVER_ID") ENABLE
+   ) ;
+
+
+--------------------------------------------------------
+--  DDL for Table DOCTYPES
+--------------------------------------------------------
+
+  CREATE TABLE "DOCTYPES"
+   (	"COLL_ID" VARCHAR2(32) DEFAULT '',
+	"TYPE_ID" NUMBER NOT NULL ENABLE,
+	"DESCRIPTION" VARCHAR2(255) DEFAULT '',
+	"ENABLED" VARCHAR2(1) DEFAULT 'Y',
+	"DOCTYPES_FIRST_LEVEL_ID" NUMBER DEFAULT NULL,
+	"DOCTYPES_SECOND_LEVEL_ID" NUMBER DEFAULT NULL,
+	"RETENTION" VARCHAR2(50) DEFAULT NULL,
+	"CUSTOM_T1" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_N1" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_F1" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D1" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T2" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_N2" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_F2" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D2" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T3" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_N3" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_F3" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D3" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T4" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_N4" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_F4" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D4" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T5" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_N5" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_F5" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D5" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T6" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D6" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T7" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D7" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T8" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D8" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T9" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D9" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T10" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_D10" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T11" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T12" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T13" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T14" VARCHAR2(10) DEFAULT '0000000000',
+	"CUSTOM_T15" VARCHAR2(10) DEFAULT '0000000000',
+	 PRIMARY KEY ("TYPE_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table EXT_DOCSERVER
+--------------------------------------------------------
+
+  CREATE TABLE "EXT_DOCSERVER"
+   (	"DOC_ID" VARCHAR2(255),
+	"PATH" VARCHAR2(255)
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table FULLTEXT
+--------------------------------------------------------
+
+  CREATE TABLE "FULLTEXT"
+   (	"COLL_ID" VARCHAR2(32 CHAR) NOT NULL ENABLE,
+	"RES_ID" NUMBER NOT NULL ENABLE,
+	"TEXT_TYPE" VARCHAR2(10 CHAR) DEFAULT 'CON' NOT NULL ENABLE,
+	"FULLTEXT_CONTENT" VARCHAR2(4000 CHAR) NOT NULL ENABLE,
+	 CONSTRAINT "FULLTEXT_PK" PRIMARY KEY ("COLL_ID", "RES_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table GROUPSECURITY
+--------------------------------------------------------
+
+  CREATE TABLE "GROUPSECURITY"
+   (	"GROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"RESGROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"CAN_VIEW" VARCHAR2(1) NOT NULL ENABLE,
+	"CAN_ADD" VARCHAR2(1) NOT NULL ENABLE,
+	"CAN_DELETE" VARCHAR2(1) NOT NULL ENABLE,
+	 PRIMARY KEY ("GROUP_ID", "RESGROUP_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table HISTORY
+--------------------------------------------------------
+
+  CREATE TABLE "HISTORY"
+   (	"ID" NUMBER NOT NULL ENABLE,
+	"TABLE_NAME" VARCHAR2(32) DEFAULT NULL,
+	"RECORD_ID" VARCHAR2(255) DEFAULT NULL,
+	"EVENT_TYPE" VARCHAR2(32) NOT NULL ENABLE,
+	"USER_ID" VARCHAR2(50) NOT NULL ENABLE,
+	"EVENT_DATE" DATE DEFAULT sysdate,
+	"INFO" VARCHAR2(1000),
+	"ID_MODULE" VARCHAR2(50) DEFAULT 'admin',
+	 PRIMARY KEY ("ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table HISTORY_BATCH
+--------------------------------------------------------
+
+  CREATE TABLE "HISTORY_BATCH"
+   (	"ID" NUMBER NOT NULL ENABLE,
+	"MODULE_NAME" VARCHAR2(32) DEFAULT NULL,
+	"BATCH_ID"  NUMBER DEFAULT NULL,
+	"EVENT_DATE" DATE DEFAULT sysdate,
+	"TOTAL_PROCESSED" NUMBER NOT NULL ENABLE,
+	"TOTAL_ERRORS" NUMBER NOT NULL ENABLE,
+	"INFO" VARCHAR2(1000),
+	 PRIMARY KEY ("ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table PARAMETERS
+--------------------------------------------------------
+
+  CREATE TABLE "PARAMETERS"
+   (	"ID" VARCHAR2(50) NOT NULL ENABLE,
+	"PARAM_VALUE_STRING" VARCHAR2(50) DEFAULT NULL,
+	"PARAM_VALUE_INT" NUMBER DEFAULT NULL,
+	 PRIMARY KEY ("ID") ENABLE
+   ) ;
+
+
+--------------------------------------------------------
+--  DDL for Table RESGROUP_CONTENT
+--------------------------------------------------------
+
+  CREATE TABLE "RESGROUP_CONTENT"
+   (	"COLL_ID" VARCHAR2(8) NOT NULL ENABLE,
+	"RES_ID" NUMBER NOT NULL ENABLE,
+	"RESGROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"SEQUENCE" NUMBER NOT NULL ENABLE,
+	 PRIMARY KEY ("COLL_ID", "RES_ID", "RESGROUP_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table RESGROUPS
+--------------------------------------------------------
+
+  CREATE TABLE "RESGROUPS"
+   (	"RESGROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"RESGROUP_DESC" VARCHAR2(255) NOT NULL ENABLE,
+	"CREATED_BY" VARCHAR2(255) NOT NULL ENABLE,
+	"CREATION_DATE" DATE DEFAULT sysdate,
+	 PRIMARY KEY ("RESGROUP_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table SECURITY
+--------------------------------------------------------
+
+  CREATE TABLE "SECURITY"
+   (	"GROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"COLL_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"WHERE_CLAUSE" VARCHAR2(255) DEFAULT NULL,
+	"MAARCH_COMMENT" VARCHAR2(1000),
+	"CAN_INSERT" VARCHAR2(1) DEFAULT 'N',
+	"CAN_UPDATE" VARCHAR2(1) DEFAULT 'N',
+	"CAN_DELETE" VARCHAR2(1) DEFAULT 'N',
+	 PRIMARY KEY ("GROUP_ID", "COLL_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table STATUS
+--------------------------------------------------------
+
+  CREATE TABLE "STATUS"
+   (	"ID" VARCHAR2(10 CHAR) NOT NULL ENABLE,
+	"LABEL_STATUS" VARCHAR2(50 CHAR) NOT NULL ENABLE,
+	"IS_SYSTEM" VARCHAR2(1 CHAR) DEFAULT 'Y' NOT NULL ENABLE,
+	"IMG_FILENAME" VARCHAR2(255 CHAR),
+	"MAARCH_MODULE" VARCHAR2(255 CHAR) DEFAULT 'apps' NOT NULL ENABLE,
+	"CAN_BE_SEARCHED" VARCHAR2(1 CHAR) DEFAULT 'Y',
+	 CONSTRAINT "STATUS_PK" PRIMARY KEY ("ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table USERGROUP_CONTENT
+--------------------------------------------------------
+
+  CREATE TABLE "USERGROUP_CONTENT"
+   (	"USER_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"GROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"PRIMARY_GROUP" VARCHAR2(1) NOT NULL ENABLE,
+	"ROLE" VARCHAR2(255) DEFAULT NULL,
+	 PRIMARY KEY ("USER_ID", "GROUP_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table USERGROUPS
+--------------------------------------------------------
+
+  CREATE TABLE "USERGROUPS"
+   (	"GROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"GROUP_DESC" VARCHAR2(255) DEFAULT NULL,
+	"ADMINISTRATOR" VARCHAR2(1) DEFAULT 'N',
+	"CUSTOM_RIGHT1" VARCHAR2(1) DEFAULT 'N',
+	"CUSTOM_RIGHT2" VARCHAR2(1) DEFAULT 'N',
+	"CUSTOM_RIGHT3" VARCHAR2(1) DEFAULT 'N',
+	"CUSTOM_RIGHT4" VARCHAR2(1) DEFAULT 'N',
+	"ENABLED" VARCHAR2(1) DEFAULT 'Y',
+	 PRIMARY KEY ("GROUP_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table USERGROUPS_SERVICES
+--------------------------------------------------------
+
+  CREATE TABLE "USERGROUPS_SERVICES"
+   (	"GROUP_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"SERVICE_ID" VARCHAR2(32) NOT NULL ENABLE,
+	 PRIMARY KEY ("GROUP_ID", "SERVICE_ID") ENABLE
+   ) ;
+
+--------------------------------------------------------
+--  DDL for Table USERS
+--------------------------------------------------------
+
+  CREATE TABLE "USERS"
+   (	"USER_ID" VARCHAR2(32) NOT NULL ENABLE,
+	"PASSWORD" VARCHAR2(255) DEFAULT NULL,
+	"FIRSTNAME" VARCHAR2(255) DEFAULT NULL,
+	"LASTNAME" VARCHAR2(255) DEFAULT NULL,
+	"PHONE" VARCHAR2(15) DEFAULT NULL,
+	"MAIL" VARCHAR2(255) DEFAULT NULL,
+	"DEPARTMENT" VARCHAR2(50) DEFAULT NULL,
+	"CUSTOM_T1" VARCHAR2(50) DEFAULT NULL,
+	"CUSTOM_T2" VARCHAR2(50) DEFAULT NULL,
+	"CUSTOM_T3" VARCHAR2(50) DEFAULT NULL,
+	"COOKIE_KEY" VARCHAR2(255) DEFAULT NULL,
+	"COOKIE_DATE" DATE DEFAULT sysdate,
+	"ENABLED" VARCHAR2(1) DEFAULT 'Y',
+	"CHANGE_PASSWORD" VARCHAR2(1) DEFAULT 'Y',
+	"DELAY" DATE DEFAULT sysdate,
+	"STATUS" VARCHAR2(10) DEFAULT 'OK',
+	 PRIMARY KEY ("USER_ID") ENABLE
+   ) ;
+
+
+--------------------------------------------------------
+--  SEQUENCES AND TRIGGERS
+--------------------------------------------------------
+
+ CREATE SEQUENCE  "SEQ_ACTIONS"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
+ create or replace TRIGGER TRG_ACTIONS
+ BEFORE INSERT ON ACTIONS
+FOR EACH ROW
+BEGIN
+  SELECT SEQ_ACTIONS.NEXTVAL INTO :NEW.ID FROM DUAL;
+END;
+/
+
+ CREATE SEQUENCE  "SEQ_DOCTYPES"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
+ create or replace TRIGGER TRG_DOCTYPES
+ BEFORE INSERT ON DOCTYPES
+FOR EACH ROW
+BEGIN
+  SELECT SEQ_DOCTYPES.NEXTVAL INTO :NEW.TYPE_ID FROM DUAL;
+END;
+/
+
+ CREATE SEQUENCE  "SEQ_HISTORY"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
+ create or replace TRIGGER TRG_HISTORY
+ BEFORE INSERT ON HISTORY
+FOR EACH ROW
+BEGIN
+  SELECT SEQ_HISTORY.NEXTVAL INTO :NEW.ID FROM DUAL;
+END;
+/
+
+ CREATE SEQUENCE  "SEQ_HISTORY_BATCH"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
+ create or replace TRIGGER TRG_HISTORY_BATCH
+ BEFORE INSERT ON HISTORY_BATCH
+FOR EACH ROW
+BEGIN
+  SELECT SEQ_HISTORY_BATCH.NEXTVAL INTO :NEW.ID FROM DUAL;
+END;
+/
+
diff --git a/core/trunk/core/sql/structure/core.postgresql.sql b/core/trunk/core/sql/structure/core.postgresql.sql
new file mode 100644
index 00000000000..97590a57024
--- /dev/null
+++ b/core/trunk/core/sql/structure/core.postgresql.sql
@@ -0,0 +1,311 @@
+
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = off;
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+SET escape_string_warning = off;
+
+DROP PROCEDURAL LANGUAGE IF EXISTS plpgsql  CASCADE;
+CREATE PROCEDURAL LANGUAGE plpgsql;
+
+SET search_path = public, pg_catalog;
+SET default_tablespace = '';
+SET default_with_oids = false;
+
+CREATE SEQUENCE actions_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 101
+  CACHE 1;
+
+CREATE TABLE actions
+(
+  id integer NOT NULL DEFAULT nextval('actions_id_seq'::regclass),
+  keyword character varying(32) NOT NULL DEFAULT ''::bpchar,
+  label_action character varying(255),
+  id_status character varying(10),
+  is_system character(1) NOT NULL DEFAULT 'N'::bpchar,
+  enabled character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  action_page character varying(255),
+  history character(1) NOT NULL DEFAULT 'N'::bpchar,
+  origin character varying(255) NOT NULL DEFAULT 'apps'::bpchar,
+  create_id  character(1) NOT NULL DEFAULT 'N'::bpchar,
+  CONSTRAINT actions_pkey PRIMARY KEY (id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE actions OWNER TO postgres;
+
+CREATE TABLE docservers
+(
+  docserver_id character varying(32) NOT NULL DEFAULT '1'::character varying,
+  device_type character varying(32) DEFAULT NULL::character varying,
+  device_label character varying(255) DEFAULT NULL::character varying,
+  is_readonly character(1) NOT NULL DEFAULT 'N'::bpchar,
+  enabled character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  size_limit bigint NOT NULL DEFAULT (0)::bigint,
+  actual_size bigint NOT NULL DEFAULT (0)::bigint,
+  path_template character varying(255) NOT NULL,
+  ext_docserver_info character varying(255) DEFAULT NULL::character varying,
+  chain_before character varying(32) DEFAULT NULL::character varying,
+  chain_after character varying(32) DEFAULT NULL::character varying,
+  creation_date timestamp without time zone NOT NULL,
+  closing_date timestamp without time zone,
+  coll_id character varying(32) NOT NULL DEFAULT 'coll_1'::character varying,
+  priority integer NOT NULL DEFAULT 10,
+  CONSTRAINT docservers_pkey PRIMARY KEY (docserver_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE docservers OWNER TO postgres;
+
+CREATE SEQUENCE doctypes_type_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 60
+  CACHE 1;
+
+CREATE TABLE doctypes
+(
+  coll_id character varying(32) NOT NULL DEFAULT ''::character varying,
+  type_id integer NOT NULL DEFAULT nextval('doctypes_type_id_seq'::regclass),
+  description character varying(255) NOT NULL DEFAULT ''::character varying,
+  enabled character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  doctypes_first_level_id integer,
+  doctypes_second_level_id integer,
+  primary_retention  character varying(50) DEFAULT NULL,
+  secondary_retention  character varying(50) DEFAULT NULL,
+  custom_t1 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_n1 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_f1 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d1 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t2 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_n2 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_f2 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d2 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t3 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_n3 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_f3 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d3 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t4 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_n4 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_f4 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d4 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t5 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_n5 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_f5 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d5 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t6 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d6 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t7 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d7 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t8 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d8 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t9 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d9 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t10 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_d10 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t11 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t12 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t13 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t14 character varying(10) DEFAULT '0000000000'::character varying,
+  custom_t15 character varying(10) DEFAULT '0000000000'::character varying,
+  is_master char(1) DEFAULT 'N'::character,
+  CONSTRAINT doctypes_pkey PRIMARY KEY (type_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE doctypes OWNER TO postgres;
+
+CREATE TABLE ext_docserver
+(
+  doc_id character varying(255) NOT NULL,
+  path character varying(255) NOT NULL,
+  CONSTRAINT ext_docserver_pkey PRIMARY KEY (doc_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE ext_docserver OWNER TO postgres;
+
+CREATE TABLE fulltext
+(
+  coll_id character varying(32) NOT NULL,
+  res_id bigint NOT NULL,
+  text_type character varying(10) NOT NULL DEFAULT 'CON'::character varying,
+  fulltext_content text,
+  CONSTRAINT coll_id_res_id PRIMARY KEY (coll_id, res_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE fulltext OWNER TO postgres;
+
+CREATE TABLE groupsecurity
+(
+  group_id character varying(32) NOT NULL,
+  resgroup_id character varying(32) NOT NULL,
+  can_view character(1) NOT NULL,
+  can_add character(1) NOT NULL,
+  can_delete character(1) NOT NULL,
+  CONSTRAINT groupsecurity_pkey PRIMARY KEY (group_id, resgroup_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE groupsecurity OWNER TO postgres;
+
+CREATE SEQUENCE history_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+CREATE TABLE history
+(
+  id bigint NOT NULL DEFAULT nextval('history_id_seq'::regclass),
+  table_name character varying(32) DEFAULT NULL::character varying,
+  record_id character varying(255) DEFAULT NULL::character varying,
+  event_type character varying(32) NOT NULL,
+  user_id character varying(50) NOT NULL,
+  event_date timestamp without time zone NOT NULL,
+  info text,
+  id_module character varying(50) NOT NULL DEFAULT 'admin'::character varying,
+  remote_ip character varying(32) DEFAULT NULL,
+  CONSTRAINT history_pkey PRIMARY KEY (id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE history OWNER TO postgres;
+
+CREATE SEQUENCE history_batch_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+CREATE TABLE history_batch
+(
+  id bigint NOT NULL DEFAULT nextval('history_batch_id_seq'::regclass),
+  module_name character varying(32) DEFAULT NULL::character varying,
+  batch_id bigint DEFAULT NULL::bigint,
+  event_date timestamp without time zone NOT NULL,
+  total_processed bigint DEFAULT NULL::bigint,
+  total_errors bigint DEFAULT NULL::bigint,
+  info text,
+  CONSTRAINT history_batch_pkey PRIMARY KEY (id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE history_batch OWNER TO postgres;
+
+CREATE TABLE parameters
+(
+  id character varying(50) NOT NULL,
+  param_value_string character varying(50) DEFAULT NULL::character varying,
+  param_value_int integer,
+  CONSTRAINT parameters_pkey PRIMARY KEY (id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE parameters OWNER TO postgres;
+
+CREATE TABLE resgroup_content
+(
+  coll_id character varying(32) NOT NULL,
+  res_id bigint NOT NULL,
+  resgroup_id character varying(32) NOT NULL,
+  "sequence" integer NOT NULL,
+  CONSTRAINT resgroup_content_pkey PRIMARY KEY (coll_id, res_id, resgroup_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE resgroup_content OWNER TO postgres;
+
+CREATE TABLE resgroups
+(
+  resgroup_id character varying(32) NOT NULL,
+  resgroup_desc character varying(255) NOT NULL,
+  created_by character varying(255) NOT NULL,
+  creation_date timestamp without time zone NOT NULL,
+  CONSTRAINT resgroups_pkey PRIMARY KEY (resgroup_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE resgroups OWNER TO postgres;
+
+CREATE TABLE "security"
+(
+  group_id character varying(32) NOT NULL,
+  coll_id character varying(32) NOT NULL,
+  where_clause text,
+  maarch_comment text,
+  can_insert character(1) NOT NULL DEFAULT 'N'::bpchar,
+  can_update character(1) NOT NULL DEFAULT 'N'::bpchar,
+  can_delete character(1) NOT NULL DEFAULT 'N'::bpchar,
+  CONSTRAINT security_pkey PRIMARY KEY (group_id, coll_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE "security" OWNER TO postgres;
+
+CREATE TABLE status
+(
+  id character varying(10) NOT NULL,
+  label_status character varying(50) NOT NULL,
+  is_system character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  img_filename character varying(255),
+  maarch_module character varying(255) NOT NULL DEFAULT 'apps'::character varying,
+  can_be_searched character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  can_be_modified character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  CONSTRAINT status_pkey PRIMARY KEY (id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE status OWNER TO postgres;
+
+CREATE TABLE usergroup_content
+(
+  user_id character varying(32) NOT NULL,
+  group_id character varying(32) NOT NULL,
+  primary_group character(1) NOT NULL,
+  "role" character varying(255) DEFAULT NULL::character varying,
+  CONSTRAINT usergroup_content_pkey PRIMARY KEY (user_id, group_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE usergroup_content OWNER TO postgres;
+
+CREATE TABLE usergroups
+(
+  group_id character varying(32) NOT NULL,
+  group_desc character varying(255) DEFAULT NULL::character varying,
+  administrator character(1) NOT NULL DEFAULT 'N'::bpchar,
+  custom_right1 character(1) NOT NULL DEFAULT 'N'::bpchar,
+  custom_right2 character(1) NOT NULL DEFAULT 'N'::bpchar,
+  custom_right3 character(1) NOT NULL DEFAULT 'N'::bpchar,
+  custom_right4 character(1) NOT NULL DEFAULT 'N'::bpchar,
+  enabled character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  CONSTRAINT usergroups_pkey PRIMARY KEY (group_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE usergroups OWNER TO postgres;
+
+CREATE TABLE usergroups_services
+(
+  group_id character varying NOT NULL,
+  service_id character varying NOT NULL,
+  CONSTRAINT usergroups_services_pkey PRIMARY KEY (group_id, service_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE usergroups_services OWNER TO postgres;
+
+CREATE TABLE users
+(
+  user_id character varying(32) NOT NULL,
+  "password" character varying(255) DEFAULT NULL::character varying,
+  firstname character varying(255) DEFAULT NULL::character varying,
+  lastname character varying(255) DEFAULT NULL::character varying,
+  phone character varying(15) DEFAULT NULL::character varying,
+  mail character varying(255) DEFAULT NULL::character varying,
+  department character varying(50) DEFAULT NULL::character varying,
+  custom_t1 character varying(50) DEFAULT '0'::character varying,
+  custom_t2 character varying(50) DEFAULT NULL::character varying,
+  custom_t3 character varying(50) DEFAULT NULL::character varying,
+  cookie_key character varying(255) DEFAULT NULL::character varying,
+  cookie_date timestamp without time zone,
+  enabled character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  change_password character(1) NOT NULL DEFAULT 'Y'::bpchar,
+  delay timestamp without time zone,
+  status character varying(10) NOT NULL DEFAULT 'OK'::character varying,
+  CONSTRAINT users_pkey PRIMARY KEY (user_id)
+)
+WITH (OIDS=FALSE);
+ALTER TABLE users OWNER TO postgres;
diff --git a/core/trunk/core/xml/actions_pages.xml b/core/trunk/core/xml/actions_pages.xml
new file mode 100644
index 00000000000..21d78b600ae
--- /dev/null
+++ b/core/trunk/core/xml/actions_pages.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ROOT>
+	<ACTIONPAGE>
+		<ID>redirect</ID>
+		<LABEL>_REDIRECTION</LABEL>
+    	<NAME>redirect</NAME>
+        <ORIGIN>module</ORIGIN> <!-- apps or module -->
+		<MODULE>entities</MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>confirm_status</ID>
+		<LABEL>_SIMPLE_CONFIRM</LABEL>
+    	<NAME>confirm_status</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>process</ID>
+		<LABEL>_PROCESS</LABEL>
+    	<NAME>process</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>index_mlb</ID>
+		<LABEL>_INDEX_FILE</LABEL>
+    	<NAME>index_mlb</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>validate_mail</ID>
+		<LABEL>_VALIDATE_QUALIF</LABEL>
+    	<NAME>validate_mail</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>view</ID>
+		<LABEL>_VIEW_DOC</LABEL>
+    	<NAME>view</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+	<ACTIONPAGE>
+		<ID>close_mail</ID>
+		<LABEL>_CLOSE_MAIL</LABEL>
+    	<NAME>close_mail</NAME>
+        <ORIGIN>apps</ORIGIN> <!-- apps or module -->
+		<MODULE></MODULE>
+    </ACTIONPAGE>
+</ROOT>
diff --git a/core/trunk/core/xml/config.xml.default b/core/trunk/core/xml/config.xml.default
new file mode 100644
index 00000000000..d450905e676
--- /dev/null
+++ b/core/trunk/core/xml/config.xml.default
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ROOT>
+	<CONFIG>
+		<corepath>C:\xampp\htdocs\maarch_entreprise\</corepath>
+		<tmppath>C:\xampp\htdocs\maarch_entreprise\tmp\</tmppath>
+		<defaultpage>C:\xampp\htdocs\maarch_entreprise\index.php</defaultpage>
+		<defaultlanguage>fr</defaultlanguage>
+	</CONFIG>
+	<BUSINESSAPPS>
+		<appid>maarch_entreprise</appid> <!-- same name as the app directory -->
+		<comment>_MAARCH_ENTREPRISE</comment>
+	</BUSINESSAPPS>
+	<TABLENAME>
+		<actions>actions</actions>
+		<authors>authors</authors>
+		<docservers>docservers</docservers>
+		<doctypes>doctypes</doctypes>
+		<extdocserver>ext_docserver</extdocserver>
+		<fulltext>fulltext</fulltext>
+		<groupsecurity>groupsecurity</groupsecurity>
+		<history>history</history>
+		<history_batch>history_batch</history_batch>
+		<param>parameters</param>
+		<resgroups>resgroups</resgroups>
+		<resgroupcontent>resgroup_content</resgroupcontent>
+		<security>security</security>
+		<status>status</status>
+		<usergroups>usergroups</usergroups>
+		<usergroupcontent>usergroup_content</usergroupcontent>
+		<usergroups_services>usergroups_services</usergroups_services>
+		<users>users</users>
+	</TABLENAME>
+</ROOT>
diff --git a/core/trunk/favicon.ico b/core/trunk/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..4b39a0dc07548e86c2d41d7948aeb501daf0dd00
GIT binary patch
literal 1082
zcmaKsYe-XJ7{}k7WS>ll3=FKmA|mQT5P^h3S(f34?h&Md*-hy~nN*}k1rkM3DCGq;
zMKlv@c-y>fW$IX~&AGj2?sm50oSO?G8uUT?_nxyRX3KN<pXZ$SJiq7s-`gQ%1v}$b
z6L#H5lA{SpAcSmXiepM*65IcG03ge0(rDa9M;o6|<rTrC*Bn|dH~h|IG$v7PM+v7a
zwAuP|;ra9!E_DH@@~SzU6De}q)^yr;&0tlYn-|7P;dc%rFlCe^jNAfkS_g|^@Mt7f
zY_oS~1${Q<0wc1sE)8bgItXKTVXh@G_vASu@mwuQoYFp&SikcFrZo59R2+v(aSV>m
zeQ*ushxmqA=0SC2aSijtL<;S_*v${+!P%Pyx8ekRng<9Ns+p?b{a6gktJo0FJaC$}
z;xNxOB_6iEOZ(wco`g?Z9%A&Bn0{XfzUv_P&I9nMFJt!ebJ*p3;p{&PPF*epgTZLA
zhDBYp$=1Hh@6+6eFpv#<`%cihl@cR<JLEz1QO(*4;GJlKqdy09Tz6jNx%QL_dtc7H
zrDel{KXIJ=x~G4!;X2OlO!%z5paVBOjF-{I_%mKpGiJCB(E1pu2CZKek(E5CE@7Ja
z;)gE4JU*5$^`Ui3h2NoqFnUMgC!5#*!~1nl;9)G^l@4p$cDRSHgZ5;rMINt-%q~yW
z281uLckYMn%?`=GIBu@43^?U!(wxkU+(tnE65in=wiXMV<{DY1#IqW-fvn;CPJiVG
zbAMVI*M4`ix%d9b5BFV)`WI|IZ@|*B*~ZwYFfYdON)nGU62;X;XNYqi;;Jyi`Xwk&
z%{kugF|c(|VyYp#MbC@brT5mBWQ9YXYO^#aJfhVk&H9YQEX|Rg>j?S9_Wm~}J|-j;
ai)FHq*ybl?qSy~W#Ujr%$8zUN3Hc3B@5_7u

literal 0
HcmV?d00001

diff --git a/core/trunk/index.php b/core/trunk/index.php
new file mode 100644
index 00000000000..4686d21bc36
--- /dev/null
+++ b/core/trunk/index.php
@@ -0,0 +1,78 @@
+<?php 
+/**
+* File : index.php
+*
+* Maarch Portal entry
+*
+* @package  maarch
+* @version 2.5
+* @since 10/2005
+* @license GPL v3
+* @author  Laurent Giovannoni  <dev@maarch.org>
+*/
+session_name('PeopleBox');
+session_start();
+require_once("core/class/class_functions.php");
+require_once("core/class/class_portal.php");
+$portal = new portal();
+$portal->unset_session();
+$portal->build_config();
+$func = new functions();
+//$func->show_array($_SESSION['config']);
+//$func->show_array($_SESSION['businessapps']);
+//$func->show_array($_SESSION['tablename']);
+if(isset($_SESSION['config']['defaultlang']) && !empty($_SESSION['config']['defaultlang']))
+{
+	include("portal/".$_SESSION['config']['defaultlang'].'.php');
+}
+/*print_r($_SESSION['config']);
+exit;*/
+if($_GET['origin'] == "scan")
+{
+	header("location: apps/".$_SESSION['businessapps'][0]['appid']."/reopen.php");
+}
+elseif(count($_SESSION['businessapps'])== 1)
+{
+	header("location: portal/launch_maarch.php?app=".$_SESSION['businessapps'][0]['appid']);
+}
+else
+{
+?>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php  echo $_SESSION['config']['defaultlang'] ?>" lang="<?php  echo $_SESSION['config']['defaultlang'] ?>">
+    <head>
+        <title><?php  echo _PORTAL_NAME;?></title>
+        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+        <meta http-equiv="Content-Language" content="<?php  echo $_SESSION['config']['defaultlang'] ?>" />
+        <link rel="stylesheet" type="text/css" href="portal/css/styles.css" media="screen" />
+        <!--[if lt IE 7.0]>  <link rel="stylesheet" type="text/css" href="portal/css/style_ie.css" media="screen" />  <![endif]-->
+        <!--[if gte IE 7.0]>  <link rel="stylesheet" type="text/css" href="portal/css/style_ie7.css" media="screen" />  <![endif]-->
+    </head>
+    <body id="bodylogin">
+        <div id="loginpage">
+            <p id="logo"><img src="portal/img/logo.gif" alt="Maarch Archives in motion"/></p>
+            <form name="formlogin" id="formlogin" method="get" action="portal/launch_maarch.php" class="forms">
+                <p>
+                    <?php  echo _SELECT_YOUR_APPLICATION;?> :
+                </p>
+                <p>
+                    <select name="app" id="app">
+                        <option value="">--</option>
+                        <?php 
+                        for($i=0;$i<=count($_SESSION['businessapps'])-1;$i++)
+                        {
+                            echo "<option value='".$_SESSION['businessapps'][$i]['appid']."'>".$_SESSION['businessapps'][$i]['comment']."</option>";
+                        }
+                        ?>
+                    </select>
+                </p>
+                <p>
+                    <input type="submit" class="button" name="submit" value="<?php  echo _ENTER;?>" />
+                </p>
+            </form>
+        </div>
+    </body>
+    </html>
+<?php 
+}
+?>
\ No newline at end of file
diff --git a/core/trunk/portal/css/style_ie.css b/core/trunk/portal/css/style_ie.css
new file mode 100644
index 00000000000..0b9bbc54879
--- /dev/null
+++ b/core/trunk/portal/css/style_ie.css
@@ -0,0 +1,116 @@
+.addforms {
+	width: 400px;
+}
+
+input.small {
+	width: 17px;
+}
+
+input.button {
+	padding: 0.2em 0 0.2em 0.5em;
+}
+
+.forms p.buttons {
+	margin-left: 41.7%;
+}
+
+#doctype {
+	height: 10em;
+}
+
+#logo {
+	margin: 0 0 20px 10px;
+}
+
+#help {
+	margin-top: 42px;
+	padding-bottom: 10px;
+}
+
+#inner_content {
+	height: 370px;
+}
+
+#content h1 {
+	height: 2em;
+	padding: 0;
+}
+
+#content h1 img {
+	margin-top: .4em;
+}
+
+#content h1 a.back {
+	font-size: .4em;
+	margin-top: 1em;
+
+}
+
+#formlogin {
+	width: 265px;
+}
+
+#formlogin input {
+	width: 128px;
+}
+
+#formlogin .nota, #formlogin p.buttons {
+	margin-right: 12px;
+}
+
+#formlogin select {
+	width: 134px;
+}
+
+#post #content {
+	padding-top: 0;
+}
+
+#post_indexing input.textbox {
+	width: 155px;
+}
+
+#post_indexing input.small {
+	width: 17px;
+}
+
+#post_indexing div label {
+	margin-right: 1px;
+}
+
+#post_indexing div ul {
+	width: 30%;
+}
+
+#post_indexing .buttons {
+	padding-right: 11px;
+}
+
+#post #pdf iframe {
+	height: 665px;
+}
+
+#titress {
+	margin-left: 5px;
+}
+
+
+#menunav {
+	padding: 5px;
+}
+
+#menunav li {
+	float: left;
+	width: 170px;
+}
+
+#menunav li ol {
+	margin-bottom: 6px;
+}
+
+
+/* aide */
+
+#helppages #nav {
+	margin-bottom: -1.8em;
+}
\ No newline at end of file
diff --git a/core/trunk/portal/css/style_ie7.css b/core/trunk/portal/css/style_ie7.css
new file mode 100644
index 00000000000..b79215e3922
--- /dev/null
+++ b/core/trunk/portal/css/style_ie7.css
@@ -0,0 +1,94 @@
+#menunav {
+	padding-bottom: 5px;
+}
+
+.addforms {
+	width: 400px;
+}
+
+input.small {
+	width: 17px;
+}
+
+input.button {
+	padding: 0.2em 0 0.2em 0.5em;
+}
+
+#doctype {
+	height: 10em;
+}
+
+#logo {
+	margin: 0 0 20px 10px;
+}
+
+#help {
+	margin-top: 42px;
+	padding-bottom: 10px;
+}
+
+
+
+#content h1 {
+	height: 2.05em;
+	padding: 0;
+}
+
+#content h1 img {
+	margin-top: .35em;
+}
+
+#content h1 a.back {
+	font-size: .5em;
+	margin-top: 1em;
+}
+
+#formlogin {
+	width: 265px;
+}
+
+#formlogin input {
+	width: 128px;
+}
+
+#formlogin .nota, #formlogin p.buttons {
+	margin-right: 12px;
+}
+
+#formlogin select {
+	width: 134px;
+}
+
+#post #content {
+	padding-top: 0;
+}
+
+#post_indexing input.textbox {
+	width: 155px;
+}
+
+#post_indexing input.small {
+	width: 17px;
+}
+
+#post_indexing div label {
+	margin-right: 1px;
+}
+
+#post_indexing div ul {
+	width: 30%;
+}
+
+#post_indexing .buttons {
+	padding-right: 11px;
+}
+
+#post #pdf iframe {
+	height: 665px;
+}
+
+#titless {
+	margin-left: 5px;
+}
+
+
diff --git a/core/trunk/portal/css/styles.css b/core/trunk/portal/css/styles.css
new file mode 100644
index 00000000000..89fdd5845c1
--- /dev/null
+++ b/core/trunk/portal/css/styles.css
@@ -0,0 +1,270 @@
+/* misc */
+
+html {
+	height: 100%;
+}
+
+body {
+	color: #666;
+	background: white url(../img/bg_body.gif) top center repeat-y;
+	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size: 11px;
+	font-weight: normal;
+	letter-spacing: .02em;
+	margin: 0;
+	padding: 0;
+	text-align: center;
+	width: 100%;
+}
+
+div, h1, h2, h3, h4, h5, h6, p, ul, ol, li {
+	margin: 0;
+	padding: 0;
+	list-style: none;
+}
+
+table {
+	font-size: 1em;
+}
+
+img {
+	border: none;
+}
+
+a, a:link, a:visited, a:hover {
+	color: #666;
+	text-decoration: none;
+}
+
+a:hover {
+	color: #1B99C4;
+}
+
+/* Forms */
+
+form, fieldset {
+	padding: 0;
+	margin: 0;
+	border: 0px solid white;
+}
+
+.addforms {
+	width: 440px;
+}
+
+label, .label {
+	cursor: pointer;
+	vertical-align: middle;
+}
+
+input, select, textarea, .forms img {
+	vertical-align: middle;
+	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size: .9em;
+}
+
+.smallforms {
+	padding: 0 12px;
+}
+
+.forms input, .forms select, .forms textarea, .smallforms select, .smallforms input {
+	background-color: White;
+	border: 1px solid #999;
+	color: #666;
+	width: 200px;
+}
+
+.forms input, .forms textarea {
+	padding: 0.1em 0.2em;
+}
+
+.forms select {
+	width: 206px;
+}
+
+input.small {
+	width: 20px;
+}
+
+select.small {
+	width: 5em;
+}
+
+input.medium {
+	width: 120px;
+}
+
+#newpage1, #newpage2 {
+	text-align: center;
+	color: #007583;
+}
+
+input.detail_box {
+	width: 260px;
+	font-size: 1em;
+}
+
+#startpage {
+	margin-right: 10px;
+}
+
+#frmletters a:hover, #frmletters a.on {
+	color: #007583;
+}
+
+#frmletters fieldset {
+	float: right;
+}
+
+/* particular cases */
+
+#dates label, #where label, .forms label.nofloat {
+	float: none;
+	display: inline;
+	width: auto;
+	margin: 0;
+	font-size: .9em;
+}
+
+#dates .label, #fordate label {
+	padding-top: .5em;
+}
+
+#doctype {
+	min-height: 10em;
+	height: auto;
+	border: 1px solid #CCC;
+	border-left: none;
+	border-right: none;
+	padding: 10px;
+}
+
+#doctype .label {
+	padding: 3em 0;
+}
+
+/* form quicksearch */
+
+#quicksearchform input.button, input.radio {
+	border: none;
+	background-color: transparent;
+	background-image: none;
+	padding: 0;
+	margin: 0;
+	width: auto;
+}
+
+/* more particular cases  */
+
+input.button {
+	border: 1px solid #44b2bf;
+	color: #007583;
+	background: white url(../img/bg_but.gif) top left repeat-x;
+	cursor: pointer;
+	width: auto;
+	padding: 0.2em 0.5em;
+	text-align: left;
+}
+
+.forms label, .forms .label {
+	float: left;
+	display: block;
+	text-align: right;
+	width: 40%;
+	margin-right: 1em;
+}
+
+.forms p {
+	clear: left;
+}
+
+.forms p.buttons {
+	margin-left: 41.3%;
+}
+
+/* Special case : back link in the title */
+
+#content h1.titdetail {
+	text-align: right;
+	padding-left: 17px;
+	padding-right: 17px;
+}
+
+#content h1 a {
+	color: White;
+}
+
+#content h1 a:hover {
+	color: White;
+	text-decoration: underline;
+}
+
+#content h1 a.back {
+	/*	float: right;
+	display: block;
+	margin-top: 1.1em;
+	font-size: .4em;*/
+	display: block;
+	padding-top: .9em;
+	font-size: .4em;
+}
+
+#content p, #bodylogin .forms p {
+	padding-bottom: 1em;
+}
+
+#content h1 span.titre {
+	font-size: 1em;
+	float: left;
+}
+
+/* footer */
+
+#footer {
+	text-align: center;
+	font-size: .8em;
+	color: #CCC;
+	background: transparent url(../img/bg_footer.gif) top left no-repeat;
+	padding: 30px 0;
+	margin: 0 20px;
+}
+
+/* Home */
+
+#bodylogin {
+	background: White url(../img/bg_home.gif) center center no-repeat;
+	height: 100%;
+	text-align: left;
+}
+
+#loginpage {
+	width: 300px;
+	height: 350px;
+	margin-left: -150px;
+	margin-top: -175px;
+	left: 50%;
+	top: 50%;
+	position: absolute;
+}
+
+#formlogin {
+	width: 255px;
+}
+
+#formlogin input {
+	width: 135px;
+}
+
+#formlogin input.button {
+	width: auto;
+	margin: 0;
+}
+
+#formlogin p.buttons, #post .forms .buttons {
+	text-align: right;
+	margin: 0;
+}
+
+#formlogin select {
+	width: 140px;
+}
diff --git a/core/trunk/portal/en.php b/core/trunk/portal/en.php
new file mode 100644
index 00000000000..fcb9b16ee3b
--- /dev/null
+++ b/core/trunk/portal/en.php
@@ -0,0 +1,17 @@
+<?php 
+/**
+* File : en.php
+*
+* French language file
+*
+* @package  Maarch framework 2.5
+* @version 2.5
+* @since 10/2005
+* @license GPL v3
+* @author  Laurent Giovannoni  <dev@maarch.org>
+*/
+/*********************** common ***********************************/
+define('_PORTAL_NAME', 'Maarch Portal');
+define('_SELECT_YOUR_APPLICATION', 'Select your application');
+define('_ENTER', 'Enter');
+?>
\ No newline at end of file
diff --git a/core/trunk/portal/fr.php b/core/trunk/portal/fr.php
new file mode 100644
index 00000000000..ef488846ed7
--- /dev/null
+++ b/core/trunk/portal/fr.php
@@ -0,0 +1,17 @@
+<?php 
+/**
+* File : fr.php
+*
+* French language file
+*
+* @package  Maarch framework 2.5
+* @version 2.5
+* @since 10/2005
+* @license GPL v3
+* @author  Laurent Giovannoni  <dev@maarch.org>
+*/
+/*********************** common ***********************************/
+define('_PORTAL_NAME', 'Portail d\'acc&egrave;s Maarch');
+define('_SELECT_YOUR_APPLICATION', 'S&eacute;lectionnez votre application');
+define('_ENTER', 'Entrer');
+?>
\ No newline at end of file
diff --git a/core/trunk/portal/img/bg_home.gif b/core/trunk/portal/img/bg_home.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6d9cd010f670ce2ecdbe4a3a48dd7a7c65cf0aff
GIT binary patch
literal 15465
zcmd72^-mmJ^zJ(Y6oz3226qaSV#O(1XlbE%@nS977I!EvgF6iFFu1#Gp}4!dyStP*
z@Aux^o1EnQ0cZWV_Rh{q_D=Sb&+|yhND2xWWTW|`?Z^Q}k8Xz!Z^n;rXHV}YPwp=7
z9(S)F2M=$S&+m7x9;Q$3hL3LN&+axaA2u!@7SHbg{rh)(`>=X(w|a5^^z^iFc6WCB
zFm-afeRV%{czb{U-?saM>xZXj)bsQ6-QE4!_3iHU{pI!T!pY6;?cM0n&Ef6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5k$DituJY(E1O
z0y5tZ>TZZFmLXw_3L;5D5}75l^#v5pQ<(^mv^v9#m@|lFGyU#U0$g6+lM!LDWbTq@
zU9mU|H>6_7Ad74eF9*`t4l+{q-P3|a@fL6&3$g?#azbsAd6P1Syc6G35EO#4J}u-_
z^#@cZMBkf&PeF-q7INqgQVu|=4^qg}h8+HoT!G|NWMK3hVN?-U)Rlg&;X+=dSX#Sr
znwwC1J|ga}#++y^&vgN`TIjK^WfT>Jp`ew@P>~<706HKKKXRcF<p(PShf5*y1BDAi
zl`@>2Gteo(;xYxX3x#0-6q1QN9#<QP1}uy|C@d&K+JN0G8~J!%|MX8Ts!9eq3#CXd
zuwj!IRyP#~b7g(g&Kf4js2nKnas~aQa5)s@Xml;=UMQJtG*#U*Pp2;#(Jl=X%b9j5
zZa0co{#!EhP%3wpGcKLNev#P;F543ZX@>-cE>IH`74K7&``MKE8t26{SnRTvKQt8~
znet=L%T|iY9~SaQZu1)g%h6IQ0ucr6yC&_z#Bl6#@Vm-OFa|!zwcMFRF1eg&u@VV(
zN24Ibr>vk}ti+KGi#5h`0vEqttOC1cZWfhJDy0$}R`JV$+6Kz-<e-RwN`c4fD_N(0
zZRlIMst;~8Lg1dN32-FHtwy1^C?ha=1eU?~Sfd_V&9zvuC5zK|P_6M;dw3B3POet+
zvDS#P=7({)j(MF$Gw6xJWr_6Xpn9F<VjTvKJ4bt|<9hAy#d_cN3SARYhr@bL^Fr@p
zsJmQ4$UD%>Lx11qh7h+Z$;1Z4w?;Xo;)UCW_-~Cu@0??s8<EWzCZSfzlugK#nisc?
zdCg68vQ5R0O%b$Z&3R1~-<k~;OKVe_BgM*ViksV-i*gT}|30R*zG>;9EE5((>u~e%
I1_0juFRh;9YXATM

literal 0
HcmV?d00001

diff --git a/core/trunk/portal/img/logo.gif b/core/trunk/portal/img/logo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c9d9c3a75beedf603ab46f57461f4bb6338a7bdc
GIT binary patch
literal 6415
zcmcIn`9I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ochOyD(H(@jC5bF=X@0kkinOVB@InMiIh|5P6
zRaGse0cW<vk5vOVa;yI<Bwx8(ojKYNH7zh6-0l3~yY(ws^m9nVqAqKG)M$bDpH%^I
zN9Sp)`>^$Wkj#Sh`LHhIeTlNj-WcVSj6Lf943qg8&eQg<KC6xkH<o^U^H;lv@ytq3
z*XZ*W0~;NRXBJW@i(+@xdip;RK=JZK#A+2dzIRSCYt|^S3sjM~XU$iAHLP6PWyW}e
zxXk-mflNT$f-WXW9+W`|!!D?167pwaQE{Rdc3nc~gT;|cZ;Yoj6GsW-@RPr$*IWkw
zU1&X{I^!MrCDux(dw%R(k!+Y?$GBjDK$|lIeq6c<d`MV~?E%VP{nspz)!4l5nI5CV
zf_jyu#3E4o5}2@gY$_2Tt3X7?;#rk%_AgrU_MwMu`dh7E9X;BiSn{j1c*x^9unU#Y
zEg2ii?8ghn5A^^vtI5vi`O^OHQuq>1jh0%<QZXnZ33Rtd{+H$cBx7_t6Rej4hl2a`
z(U&8i)dU_vFP~=dk!09;e6FbYzw-E9a|s!<>Ysek_bRD>$p%#;fll3TZ+m0N;k9}x
zR9)bVe<W;*5z7uEN1(>a5;$wQ*aB0sw-$0x*|+Z_|J^ROy8TTpk2mjkCmYzsf&lB9
zw%r~po?eCz?^TkSI6a;9H5UgVTP;4HGV$)s{j1rPJ}a#U<~m(oPfiB4_UFSzC#q&m
z46ZQEjiSC=ko^xnqHP;P=J<yFPt7H+s!-&o4>z3ue%Cv>&BaLvu=}j-JtXpJxwc{R
l32##;qQcgV`|`bqzxZ`$Y&-K|Z20R*eztv*oFWQX{vQJsQ6&HX

literal 0
HcmV?d00001

diff --git a/core/trunk/portal/launch_maarch.php b/core/trunk/portal/launch_maarch.php
new file mode 100644
index 00000000000..44faf281805
--- /dev/null
+++ b/core/trunk/portal/launch_maarch.php
@@ -0,0 +1,24 @@
+<?php 
+/**
+* File : launch_maarch.php
+*
+* Maarch launch script
+*
+* @package  maarch
+* @version 2.5
+* @since 10/2005
+* @license GPL v3
+* @author  Laurent Giovannoni  <dev@maarch.org>
+*/
+session_name('PeopleBox');
+session_start();
+if(trim($_GET['app'])<> "" )
+{
+	header("location: ../apps/".$_GET['app']."/login.php?coreurl=".$_SESSION['config']['coreurl']);
+}
+else
+{
+	header("location: ../index.php");
+}
+exit();
+?>
-- 
GitLab