From 8b28989e8a4737327138dd7e7a3b67f1ce152801 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Apr 2010 09:30:47 +0000 Subject: [PATCH] Fix: problem with php5.3 --- htdocs/cashdesk/deconnexion.php | 8 ++------ htdocs/cashdesk/include/environnement.php | 6 +----- htdocs/cashdesk/index.php | 6 +----- htdocs/main.inc.php | 8 ++++++-- htdocs/user/logout.php | 6 +----- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/htdocs/cashdesk/deconnexion.php b/htdocs/cashdesk/deconnexion.php index 64e712544d1..ad4f493368a 100644 --- a/htdocs/cashdesk/deconnexion.php +++ b/htdocs/cashdesk/deconnexion.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2008 Jeremie Ollivier * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,11 +18,7 @@ // Add real path in session $realpath=''; -if (preg_match('/\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"])) -{ - $result = preg_match('/^([^.]+)\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"],$regs); - $realpath = $regs[1]; -} +if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; // Init session. Name of session is specific to Dolibarr instance. $sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 7fab06fcac6..54715628826 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -19,11 +19,7 @@ // Add real path in session $realpath=''; -if (preg_match('/\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"])) -{ - $result = preg_match('/^([^.]+)\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"],$regs); - $realpath = $regs[1]; -} +if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; // Init session. Name of session is specific to Dolibarr instance. $sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 08c305f0d9c..60804b9d32a 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -28,11 +28,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); // Add real path in session $realpath=''; -if (preg_match('/\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"])) -{ - $result = preg_match('/^([^.]+)\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"],$regs); - $realpath = $regs[1]; -} +if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; // Init session. Name of session is specific to Dolibarr instance. $sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0c17ce2dd82..4914ad5a431 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -124,9 +124,13 @@ if (! defined('NOCSRFCHECK') && $_SERVER['REQUEST_METHOD'] != 'GET' && ! empty($ // This is to make Dolibarr working with Plesk set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +// Add real path in session name +$realpath=''; +if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; + // Init session. Name of session is specific to Dolibarr instance. -$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); -$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); +$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); +$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]); session_name($sessionname); session_start(); diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 365195c4337..a3fca4e6a2e 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -57,11 +57,7 @@ unset($_SESSION['dol_entity']); // Add real path in session $realpath=''; -if (preg_match('/\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"])) -{ - $result = preg_match('/^([^.]+)\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"],$regs); - $realpath = $regs[1]; -} +if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; // Destroy session $sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);