From a400513385201829756cfc98210d7d8a5c324bcd Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 30 Oct 2011 19:32:17 +0000 Subject: [PATCH] html_page and load_all_script can be called only once. Otherwise, there are problem with calendar.js --- html/do.php | 5 +++-- include/ac_common.php | 6 +++++- include/function_javascript.php | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/html/do.php b/html/do.php index 4d5ead662..473aa26ff 100644 --- a/html/do.php +++ b/html/do.php @@ -30,7 +30,9 @@ require_once('user_common.php'); require_once('ac_common.php'); require_once 'function_javascript.php'; if (isset ($_POST["style_user"])){$_SESSION['g_theme']=$_POST['style_user'];} -html_page_start(); + +html_page_start($_SESSION['g_theme']); + global $g_user, $cn; // if gDossier is not set redirect to form to choose a folder @@ -50,7 +52,6 @@ if ($g_user->check_dossier(dossier::id()) == 'P') exit(); } -html_page_start($_SESSION['g_theme']); load_all_script(); /* Check Browser version if < IE6 then unsupported */ $browser = $_SERVER['HTTP_USER_AGENT']; diff --git a/include/ac_common.php b/include/ac_common.php index 9b869a487..c04637b44 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -245,12 +245,16 @@ function isDate($p_date) * \param p_theme default theme * \param $p_script * \param $p_script2 another js script - * + * Must be called only once * \return none */ function html_page_start($p_theme="", $p_script="", $p_script2="") { + // check not called twiced + static $already_call=0; + if ( $already_call==1)return; + $already_call=1; $cn = new Database(); if ($p_theme != "") diff --git a/include/function_javascript.php b/include/function_javascript.php index b17fba213..911999145 100644 --- a/include/function_javascript.php +++ b/include/function_javascript.php @@ -2708,7 +2708,7 @@ function unescapebycharacter($str) } /*!\brief When data are transfered thanks ajax in a xml document, the xml * can not contains some character, to escape those characters, we must use this - * function + * function *\param $p_xml the xml to escape *\return the xml string with the forbidden char escaped *\see ajax_card.js ajaxFid @@ -2728,6 +2728,11 @@ function escape_xml($p_xml) */ function load_all_script() { + // check not called twiced + static $already_call=0; + if ( $already_call==1)return; + $already_call=1; + echo JS_INFOBULLE; echo js_include('prototype.js'); echo js_include('scriptaculous.js');