2004-10-20 23:06:45 +02:00
|
|
|
|
<?php
|
2007-01-19 19:25:10 +01:00
|
|
|
|
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-01-28 01:25:15 +01:00
|
|
|
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
2007-06-02 19:44:41 +02:00
|
|
|
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-09-01 23:23:20 +02:00
|
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
2005-10-30 01:42:54 +02:00
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
2007-01-04 00:39:26 +01:00
|
|
|
|
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
|
2002-04-30 12:56:25 +02:00
|
|
|
|
*
|
|
|
|
|
|
* 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
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program 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 this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
2002-06-26 02:03:47 +02:00
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
2002-04-30 12:56:25 +02:00
|
|
|
|
*/
|
2003-06-18 15:56:26 +02:00
|
|
|
|
|
2005-03-21 20:53:50 +01:00
|
|
|
|
/**
|
2006-12-02 16:27:47 +01:00
|
|
|
|
\file htdocs/main.inc.php
|
|
|
|
|
|
\brief Fichier de formatage generique des ecrans Dolibarr
|
|
|
|
|
|
\version $Revision$
|
2004-10-29 00:15:31 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2006-10-02 15:59:05 +02:00
|
|
|
|
// Forcage du parametrage PHP magic_quotes_gpc et nettoyage des parametres
|
2006-06-08 21:53:55 +02:00
|
|
|
|
// (Sinon il faudrait a chaque POST, conditionner
|
2005-11-22 23:27:20 +01:00
|
|
|
|
// la lecture de variable par stripslashes selon etat de get_magic_quotes).
|
2006-05-10 21:14:08 +02:00
|
|
|
|
// En mode off (recommande il faut juste faire addslashes au moment d'un insert/update.
|
2006-06-08 21:53:55 +02:00
|
|
|
|
@set_magic_quotes_runtime(0);
|
2005-11-22 23:27:20 +01:00
|
|
|
|
function stripslashes_deep($value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (get_magic_quotes_gpc())
|
|
|
|
|
|
{
|
2006-09-02 03:17:50 +02:00
|
|
|
|
$_GET = array_map('stripslashes_deep', $_GET);
|
|
|
|
|
|
$_POST = array_map('stripslashes_deep', $_POST);
|
|
|
|
|
|
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
2005-11-22 23:27:20 +01:00
|
|
|
|
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2007-01-19 19:25:10 +01:00
|
|
|
|
// Filtre les GET et POST pour supprimer les SQL INJECTION
|
|
|
|
|
|
function test_sql_inject($val)
|
|
|
|
|
|
{
|
|
|
|
|
|
$sql_inj = 0;
|
|
|
|
|
|
$sql_inj += eregi('delete[[:space:]]+from', $val);
|
|
|
|
|
|
$sql_inj += eregi('create[[:space:]]+table', $val);
|
|
|
|
|
|
$sql_inj += eregi('update.+set.+=', $val);
|
|
|
|
|
|
$sql_inj += eregi('insert[[:space:]]+into', $val);
|
|
|
|
|
|
$sql_inj += eregi('select.+from', $val);
|
|
|
|
|
|
|
|
|
|
|
|
return $sql_inj;
|
|
|
|
|
|
}
|
2007-01-19 20:27:01 +01:00
|
|
|
|
foreach ($_GET as $key => $val)
|
2007-01-19 19:25:10 +01:00
|
|
|
|
{
|
2007-01-19 20:27:01 +01:00
|
|
|
|
if (test_sql_inject($val) > 0)
|
|
|
|
|
|
unset($_GET[$key]);
|
2007-01-19 19:25:10 +01:00
|
|
|
|
}
|
2007-01-19 20:27:01 +01:00
|
|
|
|
foreach ($_POST as $key => $val)
|
2007-01-19 19:25:10 +01:00
|
|
|
|
{
|
2007-01-19 20:27:01 +01:00
|
|
|
|
if (test_sql_inject($val) > 0)
|
|
|
|
|
|
unset($_POST[$key]);
|
2007-01-19 19:25:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
// Fin filtre des GET et POST
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-01 00:49:35 +01:00
|
|
|
|
require_once("master.inc.php");
|
2003-08-30 12:33:23 +02:00
|
|
|
|
|
2006-06-03 01:20:36 +02:00
|
|
|
|
$bc[0]="class=\"impair\"";
|
|
|
|
|
|
$bc[1]="class=\"pair\"";
|
|
|
|
|
|
|
2007-05-15 01:44:36 +02:00
|
|
|
|
// Init session
|
|
|
|
|
|
$sessionname="DOLSESSID_".$dolibarr_main_db_name;
|
|
|
|
|
|
session_name($sessionname);
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
dolibarr_syslog("Session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"]);
|
|
|
|
|
|
|
2006-07-02 02:43:40 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Phase identification
|
|
|
|
|
|
*/
|
2005-03-26 14:38:30 +01:00
|
|
|
|
|
2006-07-02 02:43:40 +02:00
|
|
|
|
// $authmode contient la liste des diff<66>rents modes d'identification <20> tester
|
|
|
|
|
|
// par ordre de pr<70>f<EFBFBD>rence. Attention, rares sont les combinaisons possibles si
|
|
|
|
|
|
// plusieurs modes sont indiqu<71>s.
|
2007-05-15 01:44:36 +02:00
|
|
|
|
// Example: array('http','dolibarr');
|
|
|
|
|
|
// Example: array('http','dolibarr_mdb2');
|
|
|
|
|
|
// Example: array('ldap');
|
|
|
|
|
|
// Example: array('forceuser');
|
|
|
|
|
|
$authmode=array();
|
2007-01-04 00:57:14 +01:00
|
|
|
|
|
2007-05-21 23:44:17 +02:00
|
|
|
|
// Authentication mode: non defini (cas de compatibilite ascendante)
|
|
|
|
|
|
if (! $dolibarr_main_authentication)
|
2007-05-15 01:44:36 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Mode par defaut, on test http + dolibarr
|
|
|
|
|
|
$authmode=array('http','dolibarr');
|
|
|
|
|
|
}
|
2007-05-21 23:44:17 +02:00
|
|
|
|
|
|
|
|
|
|
// Authentication mode: http
|
|
|
|
|
|
if ($dolibarr_main_authentication == 'http')
|
|
|
|
|
|
{
|
|
|
|
|
|
$authmode=array('http');
|
|
|
|
|
|
}
|
2007-05-15 01:44:36 +02:00
|
|
|
|
// Authentication mode: dolibarr
|
|
|
|
|
|
if ($dolibarr_main_authentication == 'dolibarr')
|
|
|
|
|
|
{
|
|
|
|
|
|
$authmode=array('dolibarr');
|
|
|
|
|
|
}
|
|
|
|
|
|
// Authentication mode: dolibarr_mdb2
|
|
|
|
|
|
if ($dolibarr_main_authentication == 'dolibarr_mdb2')
|
|
|
|
|
|
{
|
|
|
|
|
|
$authmode=array('dolibarr_mdb2');
|
|
|
|
|
|
}
|
|
|
|
|
|
// Authentication mode: ldap
|
|
|
|
|
|
if ($dolibarr_main_authentication == 'ldap')
|
|
|
|
|
|
{
|
|
|
|
|
|
$authmode=array('ldap');
|
|
|
|
|
|
}
|
|
|
|
|
|
// Authentication mode: forceuser
|
|
|
|
|
|
if ($dolibarr_main_authentication == 'forceuser' || isset($dolibarr_auto_user))
|
|
|
|
|
|
{
|
|
|
|
|
|
$authmode=array('forceuser');
|
|
|
|
|
|
if (! isset($dolibarr_auto_user)) $dolibarr_auto_user='auto';
|
|
|
|
|
|
}
|
|
|
|
|
|
// No authentication mode
|
|
|
|
|
|
if (! sizeof($authmode))
|
|
|
|
|
|
{
|
|
|
|
|
|
$langs->load('main');
|
|
|
|
|
|
dolibarr_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
2006-12-09 03:23:07 +01:00
|
|
|
|
|
2006-07-02 02:43:40 +02:00
|
|
|
|
// Si la demande du login a d<>j<EFBFBD> eu lieu, on le r<>cup<75>re depuis la session
|
|
|
|
|
|
// sinon appel du module qui r<>alise sa demande.
|
|
|
|
|
|
// A l'issu de cette phase, la variable $login sera d<>finie.
|
|
|
|
|
|
$login='';
|
2006-12-12 23:44:19 +01:00
|
|
|
|
if (! session_id() || ! isset($_SESSION["dol_login"]))
|
2005-11-01 18:48:46 +01:00
|
|
|
|
{
|
2006-07-02 02:43:40 +02:00
|
|
|
|
// On est pas d<>j<EFBFBD> authentifi<66>, on demande le login/mot de passe
|
|
|
|
|
|
// A l'issu de cette demande, le login et un jeton doivent avoir <20>t<EFBFBD> plac<61>
|
2006-12-16 17:30:41 +01:00
|
|
|
|
// en session dans dol_login et la page rappel<65>e.
|
2006-06-25 22:18:56 +02:00
|
|
|
|
|
2006-07-02 02:43:40 +02:00
|
|
|
|
// MODE AUTO
|
2007-05-15 01:44:36 +02:00
|
|
|
|
if (in_array('forceuser',$authmode) && ! $login)
|
2006-07-02 02:43:40 +02:00
|
|
|
|
{
|
|
|
|
|
|
$login=$dolibarr_auto_user;
|
2007-05-15 01:44:36 +02:00
|
|
|
|
dolibarr_syslog ("Authentification ok (en mode force, login=".$login.")");
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MODE HTTP (Basic)
|
|
|
|
|
|
if (in_array('http',$authmode) && ! $login)
|
|
|
|
|
|
{
|
|
|
|
|
|
$login=$_SERVER["REMOTE_USER"];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MODE DOLIBARR
|
|
|
|
|
|
if (in_array('dolibarr',$authmode) && ! $login)
|
|
|
|
|
|
{
|
2007-01-17 15:44:13 +01:00
|
|
|
|
require_once(PEAR_PATH."/Auth/Auth.php");
|
2006-07-02 02:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
$pear = $dolibarr_main_db_type.'://'.$dolibarr_main_db_user.':'.$dolibarr_main_db_pass.'@'.$dolibarr_main_db_host.'/'.$dolibarr_main_db_name;
|
|
|
|
|
|
|
2007-04-23 00:55:32 +02:00
|
|
|
|
// \TODO Virer ce test et toujours faire le test sur le champ crypt<70>
|
2006-11-25 22:39:58 +01:00
|
|
|
|
if ($conf->password_encrypted)
|
2006-10-19 20:51:35 +02:00
|
|
|
|
{
|
|
|
|
|
|
$cryptType = "md5";
|
2007-04-23 00:55:32 +02:00
|
|
|
|
$fieldtotest="pass_crypted";
|
2006-10-19 20:51:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$cryptType = "none";
|
2007-04-23 00:55:32 +02:00
|
|
|
|
$fieldtotest="pass";
|
2006-10-19 20:51:35 +02:00
|
|
|
|
}
|
2006-10-17 00:38:56 +02:00
|
|
|
|
|
2006-07-02 02:43:40 +02:00
|
|
|
|
$params = array(
|
|
|
|
|
|
"dsn" => $pear,
|
|
|
|
|
|
"table" => MAIN_DB_PREFIX."user",
|
|
|
|
|
|
"usernamecol" => "login",
|
2007-04-23 00:55:32 +02:00
|
|
|
|
"passwordcol" => $fieldtotest,
|
2006-10-17 00:38:56 +02:00
|
|
|
|
"cryptType" => $cryptType,
|
2006-07-02 02:43:40 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
2006-09-02 03:17:50 +02:00
|
|
|
|
$aDol = new DOLIAuth("DB", $params, "dol_loginfunction");
|
2006-12-09 03:23:07 +01:00
|
|
|
|
$aDol->setSessionName($sessionname);
|
2006-07-02 02:43:40 +02:00
|
|
|
|
$aDol->start();
|
|
|
|
|
|
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
|
|
|
|
|
if ($result)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Authentification Auth OK, on va chercher le login
|
|
|
|
|
|
$login=$aDol->getUsername();
|
2007-01-04 00:57:14 +01:00
|
|
|
|
dolibarr_syslog ("Authentification ok (en mode Pear Base Dolibarr)");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isset($_POST["loginfunction"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
// Echec authentification
|
|
|
|
|
|
dolibarr_syslog("Authentification ko (en mode Pear Base Dolibarr) pour '".$_POST["username"]."'");
|
2007-09-11 19:15:44 +02:00
|
|
|
|
sleep(1);
|
2007-01-04 00:57:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2007-07-31 20:53:30 +02:00
|
|
|
|
// Non authentifie, un redirect sur page logon a <20>t<EFBFBD> envoy<6F>, on peut finir.
|
2007-01-04 00:57:14 +01:00
|
|
|
|
//dolibarr_syslog("Authentification non realise");
|
|
|
|
|
|
}
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2007-05-15 01:44:36 +02:00
|
|
|
|
// MODE DOLIBARR MDB2
|
2007-09-11 21:53:10 +02:00
|
|
|
|
//Todo: voir pour l'utiliser par d<>faut
|
2007-01-04 00:57:14 +01:00
|
|
|
|
if (in_array('dolibarr_mdb2',$authmode) && ! $login)
|
|
|
|
|
|
{
|
2007-01-17 15:44:13 +01:00
|
|
|
|
require_once(PEAR_PATH."/Auth/Auth.php");
|
2007-01-04 00:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
$pear = $dolibarr_main_db_type.'://'.$dolibarr_main_db_user.':'.$dolibarr_main_db_pass.'@'.$dolibarr_main_db_host.'/'.$dolibarr_main_db_name;
|
|
|
|
|
|
|
|
|
|
|
|
if ($conf->password_encrypted)
|
|
|
|
|
|
{
|
|
|
|
|
|
$cryptType = "md5";
|
2007-04-23 00:55:32 +02:00
|
|
|
|
$fieldtotest="pass_crypted";
|
2007-01-04 00:57:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$cryptType = "none";
|
2007-04-23 00:55:32 +02:00
|
|
|
|
$fieldtotest="pass";
|
2007-01-04 00:57:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
|
|
"dsn" => $pear,
|
|
|
|
|
|
"table" => MAIN_DB_PREFIX."user",
|
|
|
|
|
|
"usernamecol" => "login",
|
2007-04-23 00:55:32 +02:00
|
|
|
|
"passwordcol" => $fieldtotest,
|
2007-01-04 00:57:14 +01:00
|
|
|
|
"cryptType" => $cryptType,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$aDol = new DOLIAuth("MDB2", $params, "dol_loginfunction");
|
|
|
|
|
|
$aDol->setSessionName($sessionname);
|
|
|
|
|
|
$aDol->start();
|
|
|
|
|
|
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
|
|
|
|
|
if ($result)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Authentification Auth OK, on va chercher le login
|
|
|
|
|
|
$login=$aDol->getUsername();
|
2007-08-17 12:04:30 +02:00
|
|
|
|
dolibarr_syslog ("Authentification ok (en mode Pear Base Dolibarr_mdb2)");
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isset($_POST["loginfunction"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
// Echec authentification
|
2007-08-17 12:04:30 +02:00
|
|
|
|
dolibarr_syslog("Authentification ko (en mode Pear Base Dolibarr_mdb2) pour '".$_POST["username"]."'");
|
2007-09-11 19:15:44 +02:00
|
|
|
|
sleep(1);
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Non authentifie
|
|
|
|
|
|
//dolibarr_syslog("Authentification non realise");
|
|
|
|
|
|
}
|
|
|
|
|
|
exit;
|
2005-08-11 22:04:33 +02:00
|
|
|
|
}
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MODE LDAP
|
2007-05-15 01:44:36 +02:00
|
|
|
|
if (in_array('ldap',$authmode) && ! $login)
|
2006-07-02 02:43:40 +02:00
|
|
|
|
{
|
2007-05-15 01:44:36 +02:00
|
|
|
|
// Authentification Apache KO ou non active, pas de mode force on demande le login
|
2007-01-17 15:44:13 +01:00
|
|
|
|
require_once(PEAR_PATH."/Auth/Auth.php");
|
2006-09-02 03:17:50 +02:00
|
|
|
|
|
2007-05-15 01:44:36 +02:00
|
|
|
|
$ldapuserattr=$dolibarr_main_auth_ldap_login_attribute;
|
|
|
|
|
|
$ldaphost=$dolibarr_main_auth_ldap_host;
|
|
|
|
|
|
$ldapport=$dolibarr_main_auth_ldap_port;
|
|
|
|
|
|
$ldapversion=(int) $dolibarr_main_auth_ldap_version; // Si pas de int, PEAR LDAP plante.
|
|
|
|
|
|
$ldapdn=$dolibarr_main_auth_ldap_dn;
|
2007-05-29 18:39:53 +02:00
|
|
|
|
$ldapadminlogin=$dolibarr_main_auth_ldap_admin_login;
|
|
|
|
|
|
$ldapadminpass=$dolibarr_main_auth_ldap_admin_pass;
|
2007-05-15 01:44:36 +02:00
|
|
|
|
$ldapdebug=((! $dolibarr_main_auth_ldap_debug || $dolibarr_main_auth_ldap_debug=="false")?false:true);
|
|
|
|
|
|
|
|
|
|
|
|
if ($ldapdebug) print "DEBUG: Logging LDAP steps<br>\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Debut code pour compatibilite (prend info depuis config en base)
|
|
|
|
|
|
if (! $ldapuserattr && $conf->ldap->enabled)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
|
|
|
|
|
{
|
|
|
|
|
|
$ldapuserattr = $conf->global->LDAP_FIELD_LOGIN_SAMBA;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$ldapuserattr = $conf->global->LDAP_FIELD_LOGIN;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! $ldaphost) $ldaphost=$conf->global->LDAP_SERVER_HOST;
|
|
|
|
|
|
if (! $ldapport) $ldapport=$conf->global->LDAP_SERVER_PORT;
|
2007-05-29 19:16:18 +02:00
|
|
|
|
if (! $ldapversion) $ldapversion=(int) $conf->global->LDAP_SERVER_PROTOCOLVERSION;
|
2007-05-15 01:44:36 +02:00
|
|
|
|
if (! $ldapdn) $ldapdn=$conf->global->LDAP_SERVER_DN;
|
|
|
|
|
|
if (! $ldapadminlogin) $ldapadminlogin=$conf->global->LDAP_ADMIN_DN;
|
|
|
|
|
|
if (! $ldapadminpass) $ldapadminpass=$conf->global->LDAP_ADMIN_PASS;
|
|
|
|
|
|
// Fin code pour compatiblit<69>
|
|
|
|
|
|
|
2006-09-02 03:17:50 +02:00
|
|
|
|
$params = array(
|
2007-05-15 01:44:36 +02:00
|
|
|
|
'userattr' => $ldapuserattr,
|
|
|
|
|
|
'host' => $ldaphost,
|
|
|
|
|
|
'port' => $ldapport,
|
|
|
|
|
|
'version' => $ldapversion,
|
|
|
|
|
|
'basedn' => $ldapdn,
|
|
|
|
|
|
'binddn' => $ldapadminlogin,
|
|
|
|
|
|
'bindpw' => $ldapadminpass,
|
2007-06-02 00:01:53 +02:00
|
|
|
|
'debug' => $ldapdebug,
|
2006-11-24 02:21:46 +01:00
|
|
|
|
'userfilter' => ''
|
2006-09-02 03:17:50 +02:00
|
|
|
|
);
|
2007-05-15 01:44:36 +02:00
|
|
|
|
if ($ldapdebug) print "DEBUG: params=".join(',',$params)."<br>\n";
|
2006-09-02 03:17:50 +02:00
|
|
|
|
|
|
|
|
|
|
$aDol = new DOLIAuth("LDAP", $params, "dol_loginfunction");
|
2006-12-09 03:23:07 +01:00
|
|
|
|
$aDol->setSessionName($sessionname);
|
2006-09-02 03:17:50 +02:00
|
|
|
|
$aDol->start();
|
|
|
|
|
|
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
|
|
|
|
|
if ($result)
|
|
|
|
|
|
{
|
2007-05-29 21:30:35 +02:00
|
|
|
|
// Authentification Auth OK, on va chercher le login
|
|
|
|
|
|
$login=$aDol->getUsername();
|
|
|
|
|
|
dolibarr_syslog ("Authentification ok (en mode Pear Base LDAP)");
|
|
|
|
|
|
}
|
2006-09-02 03:17:50 +02:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isset($_POST["loginfunction"]))
|
|
|
|
|
|
{
|
2007-05-29 21:30:35 +02:00
|
|
|
|
// Echec authentification
|
|
|
|
|
|
dolibarr_syslog("Authentification ko (en mode Pear Base LDAP) pour '".$_POST["username"]."'");
|
2006-09-02 03:17:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Non authentifie
|
|
|
|
|
|
//dolibarr_syslog("Authentification non realise");
|
|
|
|
|
|
}
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
2003-08-31 00:08:36 +02:00
|
|
|
|
}
|
2007-04-23 00:55:32 +02:00
|
|
|
|
|
2007-09-11 19:15:44 +02:00
|
|
|
|
// Verification du code
|
|
|
|
|
|
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA)
|
|
|
|
|
|
{
|
|
|
|
|
|
include_once(DOL_DOCUMENT_ROOT.'/includes/cryptographp/cryptographp.fct.php');
|
|
|
|
|
|
//print "Info session: ".session_name().session_id();print_r($_SESSION);
|
|
|
|
|
|
if (! chk_crypt($_POST['code']))
|
|
|
|
|
|
{
|
|
|
|
|
|
session_destroy();
|
|
|
|
|
|
dolibarr_syslog('Bad value for code, connexion refused');
|
|
|
|
|
|
|
|
|
|
|
|
// On repart sur page accueil
|
|
|
|
|
|
session_name($sessionname);
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
$langs->load('main');
|
2007-09-11 20:34:57 +02:00
|
|
|
|
$langs->load('other');
|
2007-09-11 19:15:44 +02:00
|
|
|
|
$_SESSION["loginmesg"]=$langs->trans("ErrorBadValueForCode");
|
|
|
|
|
|
header('Location: '.DOL_URL_ROOT.'/index.php');
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2007-06-02 00:01:53 +02:00
|
|
|
|
// Charge l'objet user depuis son login ou son SID
|
2007-09-11 19:15:44 +02:00
|
|
|
|
$result=0;
|
2007-06-02 00:01:53 +02:00
|
|
|
|
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
|
2007-06-01 22:15:30 +02:00
|
|
|
|
{
|
|
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
|
|
|
|
|
$ldap=new Ldap();
|
|
|
|
|
|
$result=$ldap->connect_bind();
|
|
|
|
|
|
if ($result > 0)
|
|
|
|
|
|
{
|
2007-06-02 00:01:53 +02:00
|
|
|
|
// On charge les attributs du user ldap
|
|
|
|
|
|
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
2007-06-02 00:21:07 +02:00
|
|
|
|
$ldap->fetch($login);
|
2007-06-02 00:01:53 +02:00
|
|
|
|
|
2007-06-02 15:52:47 +02:00
|
|
|
|
if ($ldapdebug) print "DEBUG: UACF = ".join(',',$ldap->uacf)."<br>\n";
|
2007-06-16 15:56:05 +02:00
|
|
|
|
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dolibarr_print_date($ldap->pwdlastset,'day')."<br>\n";
|
|
|
|
|
|
if ($ldapdebug) print "DEBUG: badPasswordTime = ".dolibarr_print_date($ldap->badpwdtime,'day')."<br>\n";
|
2007-06-02 12:45:50 +02:00
|
|
|
|
|
2007-06-02 00:39:18 +02:00
|
|
|
|
//TODO : doit etre g<>r<EFBFBD> au niveau de PEAR
|
|
|
|
|
|
/*
|
2007-06-02 00:01:53 +02:00
|
|
|
|
// On stop si le mot de passe ldap doit etre modifi<66>
|
2007-06-02 00:21:07 +02:00
|
|
|
|
if ($ldap->pwdlastset == 0)
|
2007-06-02 00:01:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
session_destroy();
|
|
|
|
|
|
dolibarr_syslog('User '.$login.' must change password next logon');
|
|
|
|
|
|
if ($ldapdebug) print "DEBUG: User ".$login." must change password<br>\n";
|
|
|
|
|
|
$ldap->close();
|
|
|
|
|
|
|
|
|
|
|
|
// On repart sur page accueil
|
|
|
|
|
|
session_name($sessionname);
|
|
|
|
|
|
session_start();
|
2007-06-02 00:08:20 +02:00
|
|
|
|
$langs->load('ldap');
|
2007-06-02 00:01:53 +02:00
|
|
|
|
$_SESSION["loginmesg"]=$langs->trans("UserMustChangePassNextLogon");
|
|
|
|
|
|
header('Location: '.DOL_URL_ROOT.'/index.php');
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
2007-06-02 00:39:18 +02:00
|
|
|
|
*/
|
2007-06-02 00:01:53 +02:00
|
|
|
|
// On recherche le user dolibarr en fonction de son SID ldap
|
|
|
|
|
|
$user->search_sid = $ldap->getObjectSid($login);
|
2007-06-01 22:15:30 +02:00
|
|
|
|
if ($ldapdebug) print "DEBUG: search_sid = ".$user->search_sid."<br>\n";
|
2007-09-01 00:06:14 +02:00
|
|
|
|
$result=$user->fetch($login);
|
2007-06-02 00:01:53 +02:00
|
|
|
|
if ($result)
|
|
|
|
|
|
{
|
2007-09-01 00:06:14 +02:00
|
|
|
|
//TODO: on v<>rifie si le login a chang<6E> et on met <20> jour les attributs dolibarr
|
|
|
|
|
|
if ($user->login != $ldap->login && $ldap->login)
|
2007-06-02 00:01:53 +02:00
|
|
|
|
{
|
2007-06-02 19:44:41 +02:00
|
|
|
|
$user->login = $ldap->login;
|
2007-09-09 22:10:20 +02:00
|
|
|
|
$user->update($user);
|
2007-06-02 00:01:53 +02:00
|
|
|
|
}
|
2007-06-12 00:51:47 +02:00
|
|
|
|
//$resultUpdate = $user->update_ldap2dolibarr();
|
2007-06-02 00:01:53 +02:00
|
|
|
|
}
|
2007-06-01 22:15:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
session_destroy();
|
|
|
|
|
|
dolibarr_syslog('Synchro LDAP KO');
|
|
|
|
|
|
if ($ldapdebug) print "DEBUG: Error connect_bind = ".$ldap->error."<br>\n";
|
2007-06-02 00:01:53 +02:00
|
|
|
|
$ldap->close();
|
2007-06-01 22:15:30 +02:00
|
|
|
|
|
|
|
|
|
|
// On repart sur page accueil
|
|
|
|
|
|
session_name($sessionname);
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
$langs->load('admin');
|
|
|
|
|
|
$_SESSION["loginmesg"]=$langs->trans("LDAPSynchroKO");
|
|
|
|
|
|
header('Location: '.DOL_URL_ROOT.'/index.php');
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$result=$user->fetch($login);
|
|
|
|
|
|
}
|
2007-09-11 19:15:44 +02:00
|
|
|
|
|
2006-12-09 03:23:07 +01:00
|
|
|
|
if ($result <= 0)
|
|
|
|
|
|
{
|
2007-05-15 01:45:15 +02:00
|
|
|
|
session_destroy();
|
2007-05-20 22:07:18 +02:00
|
|
|
|
dolibarr_syslog('User not found, connexion refused');
|
2007-05-15 01:44:36 +02:00
|
|
|
|
|
|
|
|
|
|
// On repart sur page accueil
|
|
|
|
|
|
session_name($sessionname);
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
$langs->load('main');
|
|
|
|
|
|
$_SESSION["loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login);
|
|
|
|
|
|
header('Location: '.DOL_URL_ROOT.'/index.php');
|
2006-12-09 03:23:07 +01:00
|
|
|
|
exit;
|
|
|
|
|
|
}
|
2003-08-30 11:27:49 +02:00
|
|
|
|
}
|
2006-06-25 22:18:56 +02:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2006-12-12 23:44:19 +01:00
|
|
|
|
// On est d<>j<EFBFBD> en session qui a sauvegard<72> login
|
2007-09-11 19:15:44 +02:00
|
|
|
|
// Remarks: On ne sauvegarde pas objet user car pose pb dans certains cas mal identifi<66>s
|
2006-12-12 23:44:19 +01:00
|
|
|
|
$login=$_SESSION["dol_login"];
|
2007-09-11 19:15:44 +02:00
|
|
|
|
dolibarr_syslog("This is an already user logged session. _SESSION['dol_login']=".$login);
|
2006-12-12 23:44:19 +01:00
|
|
|
|
$user->fetch($login);
|
2007-09-11 19:15:44 +02:00
|
|
|
|
$login=$user->login;
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Est-ce une nouvelle session
|
2006-12-12 23:44:19 +01:00
|
|
|
|
if (! isset($_SESSION["dol_login"]))
|
2006-07-02 02:43:40 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Nouvelle session pour ce login
|
2006-12-12 23:44:19 +01:00
|
|
|
|
$_SESSION["dol_login"]=$user->login;
|
2006-12-16 17:30:41 +01:00
|
|
|
|
dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
|
2006-12-09 03:23:07 +01:00
|
|
|
|
$user->update_last_login_date();
|
2006-07-02 02:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-22 16:00:01 +02:00
|
|
|
|
// Si user admin, on force droits sur les modules base
|
|
|
|
|
|
if ($user->admin)
|
|
|
|
|
|
{
|
|
|
|
|
|
$user->rights->user->user->lire=1;
|
|
|
|
|
|
$user->rights->user->user->creer=1;
|
|
|
|
|
|
$user->rights->user->user->password=1;
|
|
|
|
|
|
$user->rights->user->user->supprimer=1;
|
|
|
|
|
|
$user->rights->user->self->creer=1;
|
|
|
|
|
|
$user->rights->user->self->password=1;
|
|
|
|
|
|
}
|
2005-08-11 22:04:33 +02:00
|
|
|
|
|
2005-10-22 16:00:01 +02:00
|
|
|
|
/**
|
2005-08-11 22:04:33 +02:00
|
|
|
|
* Overwrite configs global par configs perso
|
|
|
|
|
|
* ------------------------------------------
|
|
|
|
|
|
*/
|
2006-03-22 00:47:01 +01:00
|
|
|
|
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT) && $user->conf->MAIN_SIZE_LISTE_LIMIT > 0)
|
2005-08-11 22:04:33 +02:00
|
|
|
|
{
|
2006-03-22 00:47:01 +01:00
|
|
|
|
$conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
|
2005-08-11 22:04:33 +02:00
|
|
|
|
}
|
2005-10-13 23:39:38 +02:00
|
|
|
|
if (isset($user->conf->PRODUIT_LIMIT_SIZE))
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
|
|
|
|
|
|
}
|
2005-08-11 22:04:33 +02:00
|
|
|
|
if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT)
|
|
|
|
|
|
{
|
2005-11-01 00:49:35 +01:00
|
|
|
|
if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT)
|
2005-08-11 22:04:33 +02:00
|
|
|
|
{
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Si on a un langage perso different du langage courant global
|
2005-11-01 00:49:35 +01:00
|
|
|
|
$langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
|
|
|
|
|
|
$langs->setPhpLang($user->conf->MAIN_LANG_DEFAULT);
|
2005-08-11 22:04:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-10-02 22:38:46 +02:00
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Remplace conf->css par valeur personnalise
|
|
|
|
|
|
if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME)
|
2005-08-13 00:10:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
$conf->theme=$user->conf->MAIN_THEME;
|
|
|
|
|
|
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
|
|
|
|
|
}
|
2007-08-02 21:07:50 +02:00
|
|
|
|
// Cas de forcage du style depuis url
|
|
|
|
|
|
if (isset($_GET["theme"]) && $_GET["theme"])
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->theme=$_GET["theme"];
|
|
|
|
|
|
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
|
|
|
|
|
}
|
2005-10-02 22:38:46 +02:00
|
|
|
|
// Si feuille de style en php existe
|
|
|
|
|
|
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
|
|
|
|
|
|
|
2005-09-25 00:11:04 +02:00
|
|
|
|
if (isset($user->conf->MAIN_DISABLE_JAVASCRIPT) && $user->conf->MAIN_DISABLE_JAVASCRIPT)
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->use_javascript=! $user->conf->MAIN_DISABLE_JAVASCRIPT;
|
|
|
|
|
|
}
|
2005-08-11 22:04:33 +02:00
|
|
|
|
|
2006-12-02 16:27:47 +01:00
|
|
|
|
// SMARTY
|
|
|
|
|
|
// Definit dans le fichier de conf
|
|
|
|
|
|
// $dolibarr_smarty_libs_dir="/home/www/dolitar/external-libs/smarty/libs/";
|
|
|
|
|
|
// $dolibarr_smarty_compile="/home/www/dolitar/smarty_templates";
|
|
|
|
|
|
// $dolibarr_smarty_cache="/home/www/dolitar/smarty_cache";
|
|
|
|
|
|
|
|
|
|
|
|
$smarty_libs = $dolibarr_smarty_libs_dir. "Smarty.class.php";
|
|
|
|
|
|
if (file_exists ($smarty_libs))
|
|
|
|
|
|
{
|
|
|
|
|
|
require($smarty_libs);
|
|
|
|
|
|
$smarty = new Smarty();
|
|
|
|
|
|
$smarty->compile_dir = $dolibarr_smarty_compile;
|
|
|
|
|
|
$smarty->cache_dir = $dolibarr_smarty_cache;
|
|
|
|
|
|
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Defini gestionnaire de menu a utiliser
|
2005-09-26 02:52:33 +02:00
|
|
|
|
if (! $user->societe_id) // Si utilisateur interne
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->top_menu=$conf->global->MAIN_MENU_BARRETOP;
|
|
|
|
|
|
$conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT;
|
2006-08-02 02:52:31 +02:00
|
|
|
|
// Pour compatibilite
|
2005-10-03 03:14:50 +02:00
|
|
|
|
if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php';
|
2005-09-26 02:52:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
else // Si utilisateur externe
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->top_menu=$conf->global->MAIN_MENUFRONT_BARRETOP;
|
|
|
|
|
|
$conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT;
|
|
|
|
|
|
}
|
2005-08-11 22:04:33 +02:00
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Si le login n'a pu etre recupere, on est identifie avec un compte qui n'existe pas.
|
2005-03-26 14:38:30 +01:00
|
|
|
|
// Tentative de hacking ?
|
|
|
|
|
|
if (! $user->login) accessforbidden();
|
|
|
|
|
|
|
2006-09-02 03:17:50 +02:00
|
|
|
|
// Verifie si user actif
|
|
|
|
|
|
if ($user->statut < 1)
|
|
|
|
|
|
{
|
2006-12-02 16:27:47 +01:00
|
|
|
|
// Si non actif, on delogue le user
|
|
|
|
|
|
$langs->load("other");
|
|
|
|
|
|
dolibarr_syslog ("Authentification ko (en mode Pear Base Dolibarr) car login desactive");
|
|
|
|
|
|
accessforbidden($langs->trans("ErrorLoginDisabled"));
|
|
|
|
|
|
exit;
|
2006-09-02 03:17:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-08-11 22:04:33 +02:00
|
|
|
|
dolibarr_syslog("Access to ".$_SERVER["PHP_SELF"]);
|
|
|
|
|
|
|
2005-03-26 14:38:30 +01:00
|
|
|
|
|
2005-04-02 23:21:03 +02:00
|
|
|
|
if (! defined('MAIN_INFO_SOCIETE_PAYS'))
|
2004-11-04 21:00:15 +01:00
|
|
|
|
{
|
2005-04-02 23:21:03 +02:00
|
|
|
|
define('MAIN_INFO_SOCIETE_PAYS','1');
|
2004-11-04 21:00:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
// On charge les fichiers lang principaux
|
2004-10-31 16:54:14 +01:00
|
|
|
|
$langs->load("main");
|
2007-09-15 16:35:44 +02:00
|
|
|
|
$langs->load("dict");
|
2003-03-11 17:25:07 +01:00
|
|
|
|
|
2004-07-13 23:25:53 +02:00
|
|
|
|
/*
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
2003-09-06 14:41:17 +02:00
|
|
|
|
if (defined("MAIN_NOT_INSTALLED"))
|
|
|
|
|
|
{
|
2006-12-02 16:27:47 +01:00
|
|
|
|
Header("Location: ".DOL_URL_ROOT."/install/index.php");
|
|
|
|
|
|
exit;
|
2003-09-06 14:41:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Constantes utilise pour definir le nombre de lignes des textarea
|
2005-09-29 21:30:59 +02:00
|
|
|
|
if (! eregi("firefox",$_SERVER["HTTP_USER_AGENT"]))
|
|
|
|
|
|
{
|
2006-12-02 16:27:47 +01:00
|
|
|
|
define('ROWS_1',1);
|
|
|
|
|
|
define('ROWS_2',2);
|
|
|
|
|
|
define('ROWS_3',3);
|
|
|
|
|
|
define('ROWS_4',4);
|
|
|
|
|
|
define('ROWS_5',5);
|
|
|
|
|
|
define('ROWS_6',6);
|
|
|
|
|
|
define('ROWS_7',7);
|
|
|
|
|
|
define('ROWS_8',8);
|
|
|
|
|
|
define('ROWS_9',9);
|
2005-09-29 21:30:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2006-12-02 16:27:47 +01:00
|
|
|
|
define('ROWS_1',0);
|
|
|
|
|
|
define('ROWS_2',1);
|
|
|
|
|
|
define('ROWS_3',2);
|
|
|
|
|
|
define('ROWS_4',3);
|
|
|
|
|
|
define('ROWS_5',4);
|
|
|
|
|
|
define('ROWS_6',5);
|
|
|
|
|
|
define('ROWS_7',6);
|
|
|
|
|
|
define('ROWS_8',7);
|
|
|
|
|
|
define('ROWS_9',8);
|
2005-09-29 21:30:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-02-21 01:15:04 +01:00
|
|
|
|
|
2005-08-20 18:43:30 +02:00
|
|
|
|
|
2005-01-01 20:48:22 +01:00
|
|
|
|
/**
|
2007-05-20 22:07:18 +02:00
|
|
|
|
* \brief Affiche en-tete HTML
|
2007-05-26 01:24:21 +02:00
|
|
|
|
* \param head Lignes d'en-tete head optionnelles
|
|
|
|
|
|
* \param title Titre page web
|
|
|
|
|
|
* \param disablejs N'affiche pas les liens vers les js (Ex: qd fonction utilis<EFBFBD>e par sous formulaire Ajax)
|
2002-12-31 15:10:59 +01:00
|
|
|
|
*/
|
2007-05-26 18:52:29 +02:00
|
|
|
|
function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0)
|
2002-12-31 15:10:59 +01:00
|
|
|
|
{
|
2007-09-15 16:35:44 +02:00
|
|
|
|
global $user, $conf, $langs, $db, $micro_start_time;
|
|
|
|
|
|
|
2007-05-20 22:07:18 +02:00
|
|
|
|
// Pour le tuning optionnel. Activer si la variable d'environnement DOL_TUNING
|
|
|
|
|
|
// est positionne A appeler avant tout.
|
|
|
|
|
|
if (isset($_SERVER['DOL_TUNING'])) $micro_start_time=dol_microtime_float(true);
|
2007-08-01 11:53:36 +02:00
|
|
|
|
|
|
|
|
|
|
if (! $conf->css) $conf->css ='/theme/eldy/eldy.css.php';
|
2006-09-02 03:17:50 +02:00
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
//header("Content-type: text/html; charset=UTF-8");
|
|
|
|
|
|
header("Content-type: text/html; charset=".$conf->character_set_client);
|
2006-03-25 17:57:54 +01:00
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
2007-05-26 01:24:21 +02:00
|
|
|
|
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>';
|
2007-09-15 16:35:44 +02:00
|
|
|
|
print "\n";
|
2007-03-16 19:19:33 +01:00
|
|
|
|
print "<html>\n";
|
2007-05-26 18:52:29 +02:00
|
|
|
|
if ($disablehead == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
print "<head>\n";
|
2007-09-15 16:35:44 +02:00
|
|
|
|
|
|
|
|
|
|
print $langs->lang_header();
|
|
|
|
|
|
print $head;
|
2003-06-19 15:12:01 +02:00
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
// Affiche meta
|
|
|
|
|
|
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
|
|
|
|
|
|
print '<meta name="author" content="Dolibarr Development Team">'."\n";
|
2003-10-21 11:40:34 +02:00
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
// Affiche title
|
|
|
|
|
|
if ($title)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<title>Dolibarr - '.$title.'</title>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (defined("MAIN_TITLE"))
|
|
|
|
|
|
{
|
|
|
|
|
|
print "<title>".MAIN_TITLE."</title>";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<title>Dolibarr</title>';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
print "\n";
|
2005-04-17 02:23:43 +02:00
|
|
|
|
|
2007-09-15 16:35:44 +02:00
|
|
|
|
// Affiche style sheets et link
|
|
|
|
|
|
print '<link rel="stylesheet" type="text/css" title="default" href="'.DOL_URL_ROOT.'/'.$conf->css.'">'."\n";
|
|
|
|
|
|
print '<link rel="stylesheet" type="text/css" media="print" href="'.DOL_URL_ROOT.'/theme/print.css">'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Style sheets pour la class Window
|
|
|
|
|
|
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/default.css">'."\n";
|
|
|
|
|
|
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alphacube.css">'."\n";
|
|
|
|
|
|
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alert.css">'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Definition en alternate style sheet des feuilles de styles les plus maintenues
|
|
|
|
|
|
// Les navigateurs qui supportent sont rares. Plus aucun connu.
|
|
|
|
|
|
/*
|
|
|
|
|
|
print '<link rel="alternate stylesheet" type="text/css" title="Eldy" href="'.DOL_URL_ROOT.'/theme/eldy/eldy.css.php">'."\n";
|
|
|
|
|
|
print '<link rel="alternate stylesheet" type="text/css" title="Freelug" href="'.DOL_URL_ROOT.'/theme/freelug/freelug.css.php">'."\n";
|
|
|
|
|
|
print '<link rel="alternate stylesheet" type="text/css" title="Yellow" href="'.DOL_URL_ROOT.'/theme/yellow/yellow.css">'."\n";
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print '<link rel="top" title="'.$langs->trans("Home").'" href="'.DOL_URL_ROOT.'/">'."\n";
|
|
|
|
|
|
print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
|
|
|
|
|
|
print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
if (! $disablejs && ($conf->use_javascript || $conf->use_ajax))
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_head.js"></script>'."\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! $disablejs && $conf->use_ajax)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/lib/prototype.js"></script>'."\n";
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js"></script>'."\n";
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/effects.js"></script>'."\n";
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/controls.js"></script>'."\n";
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/window.js"></script>'."\n";
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/tooltip.js"></script>'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "</head>\n";
|
|
|
|
|
|
}
|
2005-08-20 18:43:30 +02:00
|
|
|
|
}
|
2006-09-10 20:07:09 +02:00
|
|
|
|
|
2005-08-20 18:43:30 +02:00
|
|
|
|
/**
|
2007-05-20 22:07:18 +02:00
|
|
|
|
* \brief Affiche en-tete HTML + BODY + Barre de menu superieure
|
2005-08-20 18:43:30 +02:00
|
|
|
|
* \param head lignes d'en-tete head
|
|
|
|
|
|
* \param title titre page web
|
|
|
|
|
|
* \param target target du menu Accueil
|
|
|
|
|
|
*/
|
|
|
|
|
|
function top_menu($head, $title="", $target="")
|
|
|
|
|
|
{
|
2007-05-21 20:21:43 +02:00
|
|
|
|
global $user, $conf, $langs, $db, $dolibarr_main_authentication;
|
2005-08-20 18:43:30 +02:00
|
|
|
|
|
2006-09-02 03:17:50 +02:00
|
|
|
|
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
|
|
|
|
|
|
if (! $conf->left_menu) $conf->left_menu='eldy_backoffice.php';
|
|
|
|
|
|
|
2007-06-22 09:53:08 +02:00
|
|
|
|
top_htmlhead($head, $title);
|
2002-05-04 01:01:45 +02:00
|
|
|
|
|
2006-03-25 16:02:35 +01:00
|
|
|
|
print '<body id="mainbody"><div id="dhtmltooltip"></div>';
|
2005-08-20 18:43:30 +02:00
|
|
|
|
|
|
|
|
|
|
/*
|
2006-03-28 14:54:50 +02:00
|
|
|
|
* Si la constante MAIN_NEED_UPDATE est definie (par le script de migration sql en general), c'est que
|
|
|
|
|
|
* les donnees ont besoin d'un remaniement. Il faut passer le update.php
|
2005-08-20 18:43:30 +02:00
|
|
|
|
*/
|
2006-08-13 15:30:53 +02:00
|
|
|
|
if (isset($conf->global->MAIN_NEED_UPDATE) && $conf->global->MAIN_NEED_UPDATE)
|
2003-10-29 13:39:13 +01:00
|
|
|
|
{
|
2005-08-20 18:43:30 +02:00
|
|
|
|
$langs->load("admin");
|
|
|
|
|
|
print '<div class="fiche">'."\n";
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
print '<tr><td>';
|
2005-10-31 05:57:20 +01:00
|
|
|
|
print $langs->trans("UpdateRequired",DOL_URL_ROOT.'/install/index.php');
|
2005-08-20 18:43:30 +02:00
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
|
llxFooter();
|
|
|
|
|
|
exit;
|
2003-10-29 13:39:13 +01:00
|
|
|
|
}
|
2004-08-21 14:18:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
2005-08-20 18:43:30 +02:00
|
|
|
|
/*
|
2006-03-28 14:54:50 +02:00
|
|
|
|
* Barre de menu superieure
|
2005-08-20 18:43:30 +02:00
|
|
|
|
*/
|
2006-04-23 02:01:59 +02:00
|
|
|
|
print "\n".'<!-- Start top horizontal menu -->'."\n";
|
2005-08-20 18:43:30 +02:00
|
|
|
|
print '<div class="tmenu">'."\n";
|
|
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Charge le gestionnaire des entrees de menu du haut
|
2007-03-16 19:19:33 +01:00
|
|
|
|
if (! file_exists(DOL_DOCUMENT_ROOT ."/includes/menus/barre_top/".$conf->top_menu))
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->top_menu='eldy_backoffice.php';
|
|
|
|
|
|
}
|
|
|
|
|
|
require_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_top/".$conf->top_menu);
|
2005-08-20 18:43:30 +02:00
|
|
|
|
$menutop = new MenuTop($db);
|
|
|
|
|
|
$menutop->atarget=$target;
|
|
|
|
|
|
|
|
|
|
|
|
// Affiche le menu
|
|
|
|
|
|
$menutop->showmenu();
|
|
|
|
|
|
|
|
|
|
|
|
// Lien sur fiche du login
|
|
|
|
|
|
print '<a class="login" href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$user->id.'"';
|
|
|
|
|
|
print $menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
|
|
|
|
|
|
print '>'.$user->login.'</a>';
|
|
|
|
|
|
|
|
|
|
|
|
// Lien logout
|
|
|
|
|
|
if (! isset($_SERVER["REMOTE_USER"]) || ! $_SERVER["REMOTE_USER"])
|
|
|
|
|
|
{
|
2006-08-12 21:07:14 +02:00
|
|
|
|
$title=$langs->trans("Logout");
|
2007-06-16 15:56:05 +02:00
|
|
|
|
$title.='<br><b>'.$langs->trans("ConnectedSince").'</b>: '.dolibarr_print_date($user->datelastlogin,"dayhour");
|
2007-05-21 21:08:48 +02:00
|
|
|
|
if ($dolibarr_main_authentication) $title.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$dolibarr_main_authentication;
|
2007-05-21 20:21:43 +02:00
|
|
|
|
|
|
|
|
|
|
$text.='<a href="'.DOL_URL_ROOT.'/user/logout.php"';
|
|
|
|
|
|
$text.=$menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
|
|
|
|
|
|
$text.='>';
|
|
|
|
|
|
$text.='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';
|
|
|
|
|
|
$text.=' alt="" title=""';
|
|
|
|
|
|
$text.='>';
|
|
|
|
|
|
$text.='</a>';
|
|
|
|
|
|
|
|
|
|
|
|
$html=new Form($db);
|
|
|
|
|
|
print $html->textwithtooltip('',$title,2,1,$text);
|
|
|
|
|
|
|
|
|
|
|
|
// print '<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';
|
|
|
|
|
|
// print ' alt="'.$title.'" title="'.$title.'"';
|
|
|
|
|
|
// print '>';
|
2005-08-20 18:43:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-04-23 02:01:59 +02:00
|
|
|
|
print "\n</div>\n<!-- End top horizontal menu -->\n";
|
2004-08-21 16:21:32 +02:00
|
|
|
|
|
2003-01-13 22:33:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-08-21 14:18:03 +02:00
|
|
|
|
|
2005-01-01 20:48:22 +01:00
|
|
|
|
/**
|
2004-08-21 14:18:03 +02:00
|
|
|
|
* \brief Affiche barre de menu gauche
|
2006-03-28 14:54:50 +02:00
|
|
|
|
* \param menu_array Tableau des entrees de menu
|
2004-08-21 14:18:03 +02:00
|
|
|
|
* \param help_url Url pour le lien aide ('' par defaut)
|
2006-03-28 14:54:50 +02:00
|
|
|
|
* \param form_search Formulaire de recherche permanant supplementaire
|
2003-01-13 22:33:41 +01:00
|
|
|
|
*/
|
2005-09-08 23:10:06 +02:00
|
|
|
|
function left_menu($menu_array, $help_url='', $form_search='')
|
2003-01-13 22:33:41 +01:00
|
|
|
|
{
|
2005-09-08 23:10:06 +02:00
|
|
|
|
global $user, $conf, $langs, $db;
|
2002-05-09 16:57:48 +02:00
|
|
|
|
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print '<div class="vmenuplusfiche">'."\n";
|
2005-10-02 21:20:21 +02:00
|
|
|
|
print "\n";
|
2004-08-21 16:21:32 +02:00
|
|
|
|
|
2005-09-08 23:10:06 +02:00
|
|
|
|
// Colonne de gauche
|
2005-10-02 21:20:21 +02:00
|
|
|
|
print '<!-- Debut left vertical menu -->'."\n";
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print '<div class="vmenu">'."\n";
|
2002-05-09 16:57:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Autres entrees du menu par le gestionnaire
|
2007-03-16 19:19:33 +01:00
|
|
|
|
if (! file_exists(DOL_DOCUMENT_ROOT ."/includes/menus/barre_left/".$conf->left_menu))
|
|
|
|
|
|
{
|
|
|
|
|
|
$conf->left_menu='eldy_backoffice.php';
|
|
|
|
|
|
}
|
|
|
|
|
|
require_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_left/".$conf->left_menu);
|
2005-09-08 23:10:06 +02:00
|
|
|
|
$menu=new MenuLeft($db,$menu_array);
|
|
|
|
|
|
$menu->showmenu();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Affichage des zones de recherche permanantes
|
|
|
|
|
|
$addzonerecherche=0;
|
2005-09-27 01:07:07 +02:00
|
|
|
|
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE) $addzonerecherche=1;
|
|
|
|
|
|
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT) $addzonerecherche=1;
|
|
|
|
|
|
if (($conf->produit->enabled || $conf->service->enabled) && $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE) $addzonerecherche=1;
|
2005-09-08 23:10:06 +02:00
|
|
|
|
|
|
|
|
|
|
if ($addzonerecherche && ($user->rights->societe->lire || $user->rights->produit->lire))
|
2003-11-13 18:24:47 +01:00
|
|
|
|
{
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print '<div class="blockvmenupair">';
|
|
|
|
|
|
|
2005-09-27 01:07:07 +02:00
|
|
|
|
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire)
|
2005-09-08 23:10:06 +02:00
|
|
|
|
{
|
|
|
|
|
|
$langs->load("companies");
|
2005-10-31 05:57:20 +01:00
|
|
|
|
printSearchForm(DOL_URL_ROOT.'/societe.php',DOL_URL_ROOT.'/societe.php',
|
|
|
|
|
|
img_object($langs->trans("List"),'company').' '.$langs->trans("Companies"),'soc','socname');
|
2005-09-08 23:10:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-27 01:07:07 +02:00
|
|
|
|
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire)
|
2005-09-08 23:10:06 +02:00
|
|
|
|
{
|
|
|
|
|
|
$langs->load("companies");
|
2005-10-31 05:57:20 +01:00
|
|
|
|
printSearchForm(DOL_URL_ROOT.'/contact/index.php',DOL_URL_ROOT.'/contact/index.php',
|
|
|
|
|
|
img_object($langs->trans("List"),'contact').' '.$langs->trans("Contacts"),'contact','contactname','contact');
|
2005-09-08 23:10:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-27 01:07:07 +02:00
|
|
|
|
if (($conf->produit->enabled || $conf->service->enabled) && $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE && $user->rights->produit->lire)
|
2005-09-08 23:10:06 +02:00
|
|
|
|
{
|
|
|
|
|
|
$langs->load("products");
|
2005-10-31 05:57:20 +01:00
|
|
|
|
printSearchForm(DOL_URL_ROOT.'/product/liste.php',DOL_URL_ROOT.'/product/index.php',
|
|
|
|
|
|
img_object($langs->trans("List"),'product').' '.$langs->trans("Products")."/".$langs->trans("Services"),'products','sall','product');
|
2005-09-08 23:10:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
if ($conf->categorie->enabled)
|
|
|
|
|
|
{
|
|
|
|
|
|
$langs->load("categories");
|
|
|
|
|
|
printSearchForm(DOL_URL_ROOT.'/categories/search.php',DOL_URL_ROOT.'/categories/',$langs->trans("Categories"),'categories','catname');
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
2003-11-13 18:24:47 +01:00
|
|
|
|
}
|
2005-09-08 23:10:06 +02:00
|
|
|
|
|
2006-03-28 14:54:50 +02:00
|
|
|
|
// Zone de recherche supplementaire
|
2005-09-08 23:10:06 +02:00
|
|
|
|
if ($form_search)
|
2003-10-11 12:51:49 +02:00
|
|
|
|
{
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print $form_search;
|
2003-10-11 12:51:49 +02:00
|
|
|
|
}
|
2004-01-27 15:46:59 +01:00
|
|
|
|
|
2005-09-08 23:10:06 +02:00
|
|
|
|
// Lien vers l'aide en ligne (uniquement si langue fr_FR)
|
|
|
|
|
|
if ($help_url)
|
|
|
|
|
|
{
|
|
|
|
|
|
$helpbaseurl='';
|
|
|
|
|
|
if ($langs->defaultlang == "fr_FR") $helpbaseurl='http://www.dolibarr.com/wikidev/index.php/%s';
|
2005-08-13 11:35:29 +02:00
|
|
|
|
|
2005-09-08 23:10:06 +02:00
|
|
|
|
if ($helpbaseurl) print '<div class="help"><a class="help" target="_blank" href="'.sprintf($helpbaseurl,$help_url).'">'.$langs->trans("Help").'</a></div>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2006-04-25 01:04:52 +02:00
|
|
|
|
if ($conf->global->MAIN_SHOW_BUGTRACK_LINK == 1)
|
2005-10-02 21:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Lien vers le bugtrack
|
|
|
|
|
|
$bugbaseurl='http://savannah.nongnu.org/bugs/?';
|
|
|
|
|
|
$bugbaseurl.='func=additem&group=dolibarr&privacy=1&';
|
|
|
|
|
|
$bugbaseurl.="&details=";
|
|
|
|
|
|
$bugbaseurl.=urlencode("\n\n\n\n\n-------------\n");
|
|
|
|
|
|
$bugbaseurl.=urlencode($langs->trans("Version").": ".DOL_VERSION."\n");
|
|
|
|
|
|
$bugbaseurl.=urlencode($langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."\n");
|
|
|
|
|
|
$bugbaseurl.=urlencode($langs->trans("Url").": ".$_SERVER["REQUEST_URI"]."\n");
|
|
|
|
|
|
print '<div class="help"><a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a></div>';
|
|
|
|
|
|
}
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print "\n";
|
|
|
|
|
|
print "</div>\n";
|
|
|
|
|
|
print "<!-- Fin left vertical menu -->\n";
|
2007-05-26 03:48:20 +02:00
|
|
|
|
|
|
|
|
|
|
// Cas special pour auguria.
|
|
|
|
|
|
// On le met pour tous les autres styles sinon ko avec IE6 et resolution autre que 1024x768
|
|
|
|
|
|
if ($conf->theme != 'auguria')
|
|
|
|
|
|
{
|
|
|
|
|
|
print "\n";
|
|
|
|
|
|
print '</div>'."\n";
|
|
|
|
|
|
print '<!-- fin de zone gauche, debut zon droite -->';
|
|
|
|
|
|
print '<div class="vmenuplusfiche">'."\n";
|
|
|
|
|
|
print "\n";
|
|
|
|
|
|
}
|
2005-10-02 21:20:21 +02:00
|
|
|
|
|
|
|
|
|
|
print '<!-- fiche -->'."\n";
|
2005-09-08 23:10:06 +02:00
|
|
|
|
print '<div class="fiche">'."\n";
|
2002-05-04 01:01:45 +02:00
|
|
|
|
|
|
|
|
|
|
}
|
2004-08-13 23:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-01-01 20:48:22 +01:00
|
|
|
|
/**
|
2005-10-31 05:57:20 +01:00
|
|
|
|
* \brief Affiche une zone de recherche
|
|
|
|
|
|
* \param urlaction Url du post
|
|
|
|
|
|
* \param urlobject Url du lien sur titre de la zone de recherche
|
|
|
|
|
|
* \param title Titre de la zone de recherche
|
|
|
|
|
|
* \param htmlmodesearch 'search'
|
|
|
|
|
|
* \param htmlinputname Nom du champ input du formulaire
|
2004-08-13 23:45:23 +02:00
|
|
|
|
*/
|
2004-10-20 23:06:45 +02:00
|
|
|
|
|
2004-08-13 23:45:23 +02:00
|
|
|
|
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$htmlinputname)
|
|
|
|
|
|
{
|
2005-10-31 05:57:20 +01:00
|
|
|
|
global $langs;
|
|
|
|
|
|
print '<form action="'.$urlaction.'" method="post">';
|
|
|
|
|
|
print '<a class="vmenu" href="'.$urlobject.'">';
|
|
|
|
|
|
print $title.'</a><br>';
|
|
|
|
|
|
print '<input type="hidden" name="mode" value="search">';
|
|
|
|
|
|
print '<input type="hidden" name="mode-search" value="'.$htmlmodesearch.'">';
|
|
|
|
|
|
print '<input type="text" class="flat" name="'.$htmlinputname.'" size="10"> ';
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Go").'">';
|
|
|
|
|
|
print "</form>";
|
2004-08-13 23:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-01-01 20:48:22 +01:00
|
|
|
|
/**
|
2007-05-20 22:07:18 +02:00
|
|
|
|
* \brief Impression du pied de page DIV + BODY + HTML
|
2006-03-26 00:15:27 +01:00
|
|
|
|
* \remarks Ferme 2 div
|
|
|
|
|
|
* \param foot Non utilise
|
2002-12-31 15:10:59 +01:00
|
|
|
|
*/
|
2006-03-28 14:54:50 +02:00
|
|
|
|
|
2006-03-26 00:15:27 +01:00
|
|
|
|
function llxFooter($foot='',$limitIEbug=1)
|
2002-12-12 17:42:08 +01:00
|
|
|
|
{
|
2005-12-03 21:53:18 +01:00
|
|
|
|
global $conf, $dolibarr_auto_user, $micro_start_time;
|
2005-11-01 16:58:51 +01:00
|
|
|
|
|
|
|
|
|
|
print "\n</div>\n".'<!-- end div class="fiche" -->'."\n";
|
2006-11-26 19:24:53 +01:00
|
|
|
|
print "\n</div>\n".'<!-- end div class="vmenuplusfiche" -->'."\n";
|
2005-11-01 16:58:51 +01:00
|
|
|
|
|
|
|
|
|
|
if (isset($_SERVER['DOL_TUNING']))
|
|
|
|
|
|
{
|
2007-05-20 22:07:18 +02:00
|
|
|
|
$micro_end_time=dol_microtime_float(true);
|
2007-09-15 23:04:06 +02:00
|
|
|
|
print '<script language="javascript" type="text/javascript">window.status="Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
|
|
|
|
|
|
if (function_exists("memory_get_usage"))
|
|
|
|
|
|
{
|
|
|
|
|
|
print ' - Memory usage: '.memory_get_usage();
|
2007-09-16 00:42:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
if (function_exists("zend_loader_file_encoded"))
|
|
|
|
|
|
{
|
|
|
|
|
|
print ' - Zend encoded file: '.(zend_loader_file_encoded()?'yes':'no');
|
|
|
|
|
|
}
|
2007-09-15 23:04:06 +02:00
|
|
|
|
print '"</script>';
|
2005-11-01 16:58:51 +01:00
|
|
|
|
print "\n";
|
|
|
|
|
|
}
|
2005-12-03 21:53:18 +01:00
|
|
|
|
|
|
|
|
|
|
if ($conf->use_javascript)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_foot.js"></script>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2006-03-26 00:15:27 +01:00
|
|
|
|
// Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent
|
2007-05-11 02:12:24 +02:00
|
|
|
|
if ($limitIEbug && ! $conf->browser->firefox) print "\n".'<div class="tabsAction"> </div>'."\n";
|
2005-11-01 16:58:51 +01:00
|
|
|
|
|
2005-12-03 21:53:18 +01:00
|
|
|
|
print "</body>\n";
|
|
|
|
|
|
print "</html>\n";
|
2002-05-09 16:57:48 +02:00
|
|
|
|
}
|
2007-01-03 01:07:57 +01:00
|
|
|
|
|
2006-04-23 02:01:59 +02:00
|
|
|
|
?>
|