diff --git a/maarch_entreprise/trunk/index.php b/maarch_entreprise/trunk/index.php index 20c0102990cd82dcc8d310f0d457338162b529d1..017b46fd206599eb554944e5d0302eb84718ca16 100644 --- a/maarch_entreprise/trunk/index.php +++ b/maarch_entreprise/trunk/index.php @@ -217,7 +217,55 @@ $time = $core->get_session_time_expire(); echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&page=logout&logout=true');" id="maarch_body"> -<?php + + <?php + //do it only once + if (empty($_SESSION['clientSideCookies'])) { + ?> + <script type="text/javascript"> + function getCookies() { + + //document.cookie = "maarch_cookie_1=thefirstcookie"; + //document.cookie = "maarch_cookie_2=thesecondcookie"; + //console.log(document.cookie); + return document.cookie; + }; + + var theCookies; + //theCookies = getCookies().split(";"); + theCookies = getCookies(); + + + if (theCookies != undefined) { + //console.log('The cookies...'); + //console.log(theCookies); + var path_manage_script = '<?php echo $_SESSION["config"]["businessappurl"];?>' + 'index.php?display=true&page=setProxyCookies'; + + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { + cookies : theCookies + }, + onSuccess: function(answer) + { + eval('response = ' + answer.responseText); + //console.log(response); + if (response.status == '0') { + //console.log('OK !!! COOKIES FROM PROXY SET'); + } else { + //console.log('KO... COOKIES FROM PROXY NOT SET'); + } + + } + }); + } else { + //console.log('no completements cookies'); + } + </script> + <?php + } + if (!isset($_REQUEST['display'])) { ?> <script> var element = document; diff --git a/maarch_entreprise/trunk/setProxyCookies.php b/maarch_entreprise/trunk/setProxyCookies.php new file mode 100755 index 0000000000000000000000000000000000000000..e4c22707a12b31855453666170f35b289fa39e51 --- /dev/null +++ b/maarch_entreprise/trunk/setProxyCookies.php @@ -0,0 +1,30 @@ +<?php + +/* +* Copyright 2008-2016 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/>. +*/ + +if (!empty($_REQUEST['cookies'])) { + $_SESSION['clientSideCookies'] = $_REQUEST['cookies']; + echo "{status : '0'}"; +} else { + $_SESSION['clientSideCookies'] = false; + echo "{status : '1'}"; +} + +exit;