diff --git a/html/ajax.php b/html/ajax.php
index 542cec329..9194f529e 100644
--- a/html/ajax.php
+++ b/html/ajax.php
@@ -15,7 +15,7 @@ if ( !isset ($_REQUEST['gDossier'])) exit();
mb_internal_encoding("UTF-8");
$cn=new Database(dossier::id());
-global $g_user;
+global $g_user,$cn,$g_parameter;
$g_user=new User($cn);
$g_user->check(true);
diff --git a/html/ajax_history.php b/html/ajax_history.php
index 736d7397e..ec3451c3d 100644
--- a/html/ajax_history.php
+++ b/html/ajax_history.php
@@ -38,7 +38,7 @@ mb_internal_encoding("UTF-8");
*if $_SESSION['g_user'] is not set : echo a warning
*/
ajax_disconnected($div);
-global $g_user;
+global $g_user,$cn;
$cn=new Database(dossier::id());
$g_user=new User($cn);
/* security */
diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php
index d973b5bf4..6f464a2a2 100644
--- a/html/ajax_ledger.php
+++ b/html/ajax_ledger.php
@@ -47,7 +47,7 @@ if ( ! isset ($_REQUEST['act'])|| ! isset ($_REQUEST['jr_id'])
{
exit();
}
- global $g_parameter;
+ global $g_user,$cn,$g_parameter;
mb_internal_encoding("UTF-8");
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 7d71fd109..9349bd1fa 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -57,7 +57,7 @@ if ($cont != 0)
exit();
extract($_REQUEST);
set_language();
-global $g_user,$cn;
+global $g_user,$cn,$g_parameter;
$cn = new Database($gDossier);
$g_user = new User($cn);
$g_user->check(true);
diff --git a/html/export.php b/html/export.php
index f19adbdff..3a481fef3 100644
--- a/html/export.php
+++ b/html/export.php
@@ -26,7 +26,7 @@
*
*/
-global $g_user;
+global $g_user,$cn,$g_parameter;
require_once('class_database.php');
require_once('class_user.php');
$gDossier=dossier::id();
diff --git a/html/extension.raw.php b/html/extension.raw.php
index 849bd9a7f..28c2ea1a5 100644
--- a/html/extension.raw.php
+++ b/html/extension.raw.php
@@ -35,8 +35,9 @@ require_once('class_iselect.php');
require_once ('constant.security.php');
require_once ('class_user.php');
+global $g_user,$cn,$g_parameter;
+
$cn=new Database(dossier::id());
-global $g_user;
$g_user=new User($cn);
$g_user->check();
$only_plugin=$g_user->check_dossier(dossier::id());
diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php
index ece48eedf..cbd0e15f4 100644
--- a/include/cfgledger.inc.php
+++ b/include/cfgledger.inc.php
@@ -35,7 +35,7 @@ require_once ("user_menu.php");
require_once 'class_acc_ledger.php';
$gDossier=dossier::id();
-$cn=new Database($gDossier);
+global $cn;
$ledger=new Acc_Ledger($cn,-1);
$sa=HtmlInput::default_value("sa","",$_REQUEST);