mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 18:48:22 +01:00
Fix several pb of duplicate functions in some cases
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Function to return value of a static property when class
|
||||
* name is dynamically defined (not hard coded).
|
||||
@@ -595,12 +596,15 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
|
||||
|
||||
/**
|
||||
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
|
||||
* This prefix is unique for instance and avoid conflict between multi-instances,
|
||||
* even when having two instances with one root dir or two instances in virtual servers.
|
||||
* This prefix is valid in a web context only and is unique for instance and avoid conflict
|
||||
* between multi-instances, even when having two instances with one root dir or two instances
|
||||
* in virtual servers.
|
||||
*
|
||||
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
|
||||
* @return string A calculated prefix
|
||||
*/
|
||||
if (! function_exists('dol_getprefix'))
|
||||
{
|
||||
function dol_getprefix($mode='')
|
||||
{
|
||||
global $conf;
|
||||
@@ -615,11 +619,12 @@ function dol_getprefix($mode='')
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
|
||||
{
|
||||
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
// Use this for a "clear" cookie name
|
||||
// Use this for a "readable" cookie name
|
||||
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
else return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an include_once using default root and alternate root if it fails.
|
||||
|
||||
@@ -126,21 +126,21 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
|
||||
* @param Societe $mysoc Company object
|
||||
* @return void
|
||||
*/
|
||||
if (! function_exists('dol_loginfunction'))
|
||||
{
|
||||
function dol_loginfunction($langs,$conf,$mysoc)
|
||||
{
|
||||
global $dolibarr_main_demo,$db;
|
||||
global $smartphone,$hookmanager;
|
||||
|
||||
$langs->loadLangs(array("main","other","help","admin"));
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
$hookmanager->initHooks(array('mainloginpage'));
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("other");
|
||||
$langs->load("help");
|
||||
$langs->load("admin");
|
||||
|
||||
$main_authentication=$conf->file->main_authentication;
|
||||
$session_name=session_name();
|
||||
|
||||
$session_name=session_name(); // Get current session name
|
||||
|
||||
$dol_url_root = DOL_URL_ROOT;
|
||||
|
||||
@@ -151,6 +151,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
$titletruedolibarrversion=constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version
|
||||
|
||||
// Note: $conf->css looks like '/theme/eldy/style.css.php'
|
||||
/*
|
||||
$conf->css = "/theme/".(GETPOST('theme','alpha')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
|
||||
$themepath=dol_buildpath($conf->css,1);
|
||||
if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application
|
||||
@@ -165,6 +166,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
}
|
||||
}
|
||||
$conf_css = $themepath."?lang=".$langs->defaultlang;
|
||||
*/
|
||||
|
||||
// Select templates dir
|
||||
if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application
|
||||
@@ -182,7 +184,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
}
|
||||
|
||||
// Set cookie for timeout management
|
||||
$prefix=dol_getprefix();
|
||||
$prefix=dol_getprefix('');
|
||||
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
|
||||
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
|
||||
|
||||
@@ -300,6 +302,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
|
||||
$_SESSION["dol_loginmesg"] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction pour initialiser un salt pour la fonction crypt.
|
||||
|
||||
@@ -46,6 +46,7 @@ $disablenofollow=1;
|
||||
if (! preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow=0;
|
||||
|
||||
print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
|
||||
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
|
||||
|
||||
|
||||
@@ -153,7 +153,11 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
|
||||
|
||||
|
||||
// Check consistency of NOREQUIREXXX DEFINES
|
||||
if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them');
|
||||
if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU'))
|
||||
{
|
||||
print 'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Sanity check on URL
|
||||
if (! empty($_SERVER["PHP_SELF"]))
|
||||
@@ -204,7 +208,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
|
||||
}
|
||||
|
||||
// Init session. Name of session is specific to Dolibarr instance.
|
||||
$prefix=dol_getprefix();
|
||||
$prefix=dol_getprefix('');
|
||||
$sessionname='DOLSESSID_'.$prefix;
|
||||
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
|
||||
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
|
||||
@@ -479,6 +483,7 @@ if (! defined('NOLOGIN'))
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
|
||||
$langs=new Translate("",$conf);
|
||||
$langcode=(GETPOST('lang','aZ09',1)?GETPOST('lang','aZ09',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
|
||||
if (defined('MAIN_LANG_DEFAULT')) $langcode=constant('MAIN_LANG_DEFAULT');
|
||||
$langs->setDefaultLang($langcode);
|
||||
}
|
||||
|
||||
@@ -1164,6 +1169,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
|
||||
print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
|
||||
if (! empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n";
|
||||
|
||||
@@ -63,7 +63,7 @@ if (GETPOST('dol_no_mouse_hover')) $url.=(preg_match('/\?/',$url)?'&':'?')
|
||||
if (GETPOST('dol_use_jmobile')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_use_jmobile=1';
|
||||
|
||||
// Destroy session
|
||||
$prefix=dol_getprefix();
|
||||
$prefix=dol_getprefix('');
|
||||
$sessionname='DOLSESSID_'.$prefix;
|
||||
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
|
||||
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
|
||||
|
||||
@@ -169,6 +169,7 @@ else
|
||||
}
|
||||
|
||||
// Note: $conf->css looks like '/theme/eldy/style.css.php'
|
||||
/*
|
||||
$conf->css = "/theme/".(GETPOST('theme','alpha')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
|
||||
$themepath=dol_buildpath($conf->css,1);
|
||||
if (! empty($conf->modules_parts['theme'])) // This slow down
|
||||
@@ -183,6 +184,7 @@ if (! empty($conf->modules_parts['theme'])) // This slow down
|
||||
}
|
||||
}
|
||||
$conf_css = $themepath."?lang=".$langs->defaultlang;
|
||||
*/
|
||||
|
||||
$jquerytheme = 'smoothness';
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
|
||||
|
||||
Reference in New Issue
Block a user