2
0
forked from Wavyzz/dolibarr

Look and feel v13

This commit is contained in:
Laurent Destailleur
2020-12-07 15:51:22 +01:00
parent e77413e1e4
commit 3fb63e6a4b
3 changed files with 64 additions and 97 deletions

View File

@@ -924,30 +924,33 @@ function purgeSessions($mysessionid)
dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath);
$error = 0;
$dh = @opendir(dol_osencode($sessPath));
while (($file = @readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
$fullpath = $sessPath.$file;
if (!@is_dir($fullpath)) {
$sessValues = file_get_contents($fullpath); // get raw session data
if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session
preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i', $sessValues) && // limit to current entity
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) { // limit to company name
$tmp = explode('_', $file);
$idsess = $tmp[1];
// We remove session if it's not ourself
if ($idsess != $mysessionid) {
$res = @unlink($fullpath);
if (!$res) {
$error++;
$dh = @opendir(dol_osencode($sessPath));
if ($dh) {
while (($file = @readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
$fullpath = $sessPath.$file;
if (!@is_dir($fullpath)) {
$sessValues = file_get_contents($fullpath); // get raw session data
if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session
preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i', $sessValues) && // limit to current entity
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) { // limit to company name
$tmp = explode('_', $file);
$idsess = $tmp[1];
// We remove session if it's not ourself
if ($idsess != $mysessionid) {
$res = @unlink($fullpath);
if (!$res) {
$error++;
}
}
}
}
}
}
@closedir($dh);
}
@closedir($dh);
if (!$error) {
return 1;