Fix: remove useless code

This commit is contained in:
Regis Houssin
2012-01-11 22:59:18 +08:00
parent b670de36a9
commit 199e22fd70
3 changed files with 7 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@@ -145,7 +145,7 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
function dol_loginfunction($langs,$conf,$mysoc)
{
global $dolibarr_main_demo,$db;
global $smartphone;
global $smartphone,$mc;
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
$langs->setDefaultLang($langcode);
@@ -214,12 +214,12 @@ function dol_loginfunction($langs,$conf,$mysoc)
}
// Entity cookie
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
if (! empty($conf->multicompany->enabled))
{
$lastuser = '';
$lastentity = $_POST['entity'];
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
if (! empty($conf->global->MULTICOMPANY_COOKIE_ENABLED))
{
$prefix=dol_getprefix();
$entityCookieName = 'DOLENTITYID_'.$prefix;

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2008 Matteli
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
@@ -576,7 +576,7 @@ if (! defined('NOLOGIN'))
$prefix=dol_getprefix();
$entityCookieName = 'DOLENTITYID_'.$prefix;
// TTL : is defined in the config page multicompany
$ttl = (! empty($conf->global->MULTICOMPANY_COOKIE_TTL) ? $conf->global->MULTICOMPANY_COOKIE_TTL : time()+60*60*8 );
$ttl = (! empty($conf->global->MULTICOMPANY_COOKIE_TTL) ? dol_now()+$conf->global->MULTICOMPANY_COOKIE_TTL : dol_now()+60*60*8 );
// Cryptkey : will be created randomly in the config page multicompany
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
@@ -137,20 +137,6 @@ if (! defined('NOREQUIREDB'))
{
$conf->entity = GETPOST("entity",'int');
}
else if (! empty($conf->file->cookie_cryptkey))
{
$prefix=dol_getprefix();
$entityCookieName = 'DOLENTITYID_'.$prefix;
if (! empty($_COOKIE[$entityCookieName])) // Just for view specific login page
{
include_once(DOL_DOCUMENT_ROOT."/core/class/cookie.class.php");
$lastuser = ''; $lastentity = '';
$entityCookie = new DolCookie($conf->file->cookie_cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
$conf->entity = $lastentity;
}
}
//print "Will work with data into entity instance number '".$conf->entity."'";