mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-25 02:41:26 +01:00
Tout ce qui concerne l'environnement est dans master.inc.php et au sein du fichier on charge d'abord user, lang et conf sans enchassement de code (d'abord l'un complètement puis l'autre). Tout ce qui concerne la partie communes des écrans est dans main.inc.php
200 lines
7.7 KiB
PHP
200 lines
7.7 KiB
PHP
<?PHP
|
|
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
|
* Copyright (C) 2004-2006 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-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
|
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
|
* Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
|
|
*
|
|
* 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.
|
|
*
|
|
* $Id$
|
|
* $Source$
|
|
*/
|
|
|
|
/**
|
|
\file htdocs/master.inc.php
|
|
\brief Fichier de preparation de l'environnement Dolibarr
|
|
\version $Revision$
|
|
*/
|
|
|
|
define('DOL_VERSION','2.1-alpha');
|
|
|
|
// La fonction clearstatcache ne doit pas etre appelé de manière globale car ralenti.
|
|
// Elle doit etre appelée uniquement par les pages qui ont besoin d'un cache fichier vidé
|
|
// comme par exemple document.php
|
|
//clearstatcache();
|
|
|
|
// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
|
|
if (function_exists("define_syslog_variables"))
|
|
{
|
|
define_syslog_variables();
|
|
}
|
|
//error_reporting(E_ALL);
|
|
error_reporting(E_ALL ^ E_NOTICE);
|
|
|
|
// Test si install ok
|
|
if (! @include_once("conf/conf.php"))
|
|
{
|
|
Header("Location: install/index.php");
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
if (! isset($dolibarr_main_db_host))
|
|
{
|
|
Header("Location: install/index.php");
|
|
exit;
|
|
}
|
|
}
|
|
|
|
if (! isset($dolibarr_main_db_type))
|
|
{
|
|
$dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
|
|
}
|
|
if (! $dolibarr_main_data_root) {
|
|
// Si repertoire documents non defini, on utilise celui par defaut
|
|
$dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root);
|
|
$dolibarr_main_data_root.="/documents";
|
|
}
|
|
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
|
|
define('DOL_DATA_ROOT', $dolibarr_main_data_root);
|
|
|
|
$uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root);
|
|
$pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine
|
|
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
|
|
define('DOL_URL_ROOT', $pos);
|
|
|
|
|
|
/*
|
|
* Creation objet $conf
|
|
*/
|
|
require_once(DOL_DOCUMENT_ROOT."/conf/conf.class.php");
|
|
$conf = new Conf();
|
|
$conf->db->host = $dolibarr_main_db_host;
|
|
$conf->db->name = $dolibarr_main_db_name;
|
|
$conf->db->user = $dolibarr_main_db_user;
|
|
$conf->db->pass = $dolibarr_main_db_pass;
|
|
$conf->db->type = $dolibarr_main_db_type;
|
|
if (! $conf->db->type) { $conf->db->type = 'mysql'; } // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
|
|
// Defini prefix
|
|
if (isset($_SERVER["LLX_DBNAME"])) $dolibarr_main_db_prefix=$_SERVER["LLX_DBNAME"];
|
|
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
|
$conf->db->prefix = $dolibarr_main_db_prefix;
|
|
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
|
|
|
// Chargement des includes principaux
|
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
|
require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
|
require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
|
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
|
require_once(DOL_DOCUMENT_ROOT ."/lib/".$conf->db->type.".lib.php");
|
|
|
|
/*
|
|
* Creation objet $db
|
|
*/
|
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
|
if (! $db->connected) {
|
|
dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
|
exit;
|
|
}
|
|
|
|
/*
|
|
* Creation objet $user
|
|
*/
|
|
$user = new User($db);
|
|
|
|
/*
|
|
* Chargement objet $conf
|
|
*/
|
|
$conf->setValues($db);
|
|
|
|
/*
|
|
* Creation objet $langs
|
|
*/
|
|
require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
|
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
|
|
|
/*
|
|
* Chargement objet $langs
|
|
*/
|
|
$langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT);
|
|
$langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
|
|
|
|
|
/*
|
|
* Pour utiliser d'autres versions des librairies externes que les
|
|
* versions embarquées dans Dolibarr, définir les constantes adequates:
|
|
* Pour FPDF: FPDF_PATH
|
|
* Pour PEAR: PEAR_PATH
|
|
* Pour PHP_WriteExcel: PHP_WRITEEXCEL_PATH
|
|
* Pour PHPlot: PHPLOT_PATH
|
|
* Pour MagpieRss: MAGPIERSS_PATH
|
|
*/
|
|
if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); }
|
|
if (! defined('PEAR_PATH')) { define('PEAR_PATH', DOL_DOCUMENT_ROOT .'/includes/pear/'); }
|
|
if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); }
|
|
if (! defined('PHPLOT_PATH')) { define('PHPLOT_PATH', DOL_DOCUMENT_ROOT .'/includes/phplot/'); }
|
|
if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); }
|
|
if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); }
|
|
define('FPDF_FONTPATH', FPDF_PATH . 'font/');
|
|
define('MAGPIE_DIR', MAGPIERSS_PATH);
|
|
|
|
// \todo Ajouter la ligne
|
|
// require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
|
// dans le fichier facturation-emission.php du module telephonie afin de pouvoir supprimer la ligne suivante
|
|
if (defined("MAIN_MODULE_TELEPHONIE") && MAIN_MODULE_TELEPHONIE) require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
|
// require_once(FPDF_PATH . "fpdf.php");
|
|
// dans le fichier pdfdetail_standard_modeles du module telephonie afin de pouvoir supprimer la ligne suivante
|
|
if (defined("MAIN_MODULE_TELEPHONIE") && MAIN_MODULE_TELEPHONIE) require_once(FPDF_PATH . "fpdf.php");
|
|
|
|
|
|
/*
|
|
* Creation objet mysoc
|
|
* Objet Societe qui contient carac de l'institution géré par Dolibarr.
|
|
*/
|
|
require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
|
$mysoc=new Societe($db);
|
|
$mysoc->id=0;
|
|
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
|
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
|
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP;
|
|
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
|
$mysoc->pays_code=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
|
$mysoc->tel=$conf->global->MAIN_INFO_SOCIETE_TEL;
|
|
$mysoc->fax=$conf->global->MAIN_INFO_SOCIETE_FAX;
|
|
$mysoc->url=$conf->global->MAIN_INFO_SOCIETE_WEB;
|
|
$mysoc->siren=$conf->global->MAIN_INFO_SIREN;
|
|
$mysoc->siret=$conf->global->MAIN_INFO_SIRET;
|
|
$mysoc->ape=$conf->global->MAIN_INFO_APE;
|
|
$mysoc->rcs=$conf->global->MAIN_INFO_RCS;
|
|
$mysoc->tva_assuj=$conf->global->FACTURE_TVAOPTION;
|
|
$mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA;
|
|
$mysoc->capital=$conf->global->MAIN_INFO_CAPITAL;
|
|
$mysoc->forme_juridique_code=$conf->global->MAIN_INFO_FORME_JURIDIQUE;
|
|
$mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL;
|
|
$mysoc->adresse_full=$mysoc->adresse."\n".$mysoc->cp." ".$mysoc->ville;
|
|
$mysoc->logo=$conf->global->MAIN_INFO_SOCIETE_LOGO;
|
|
|
|
|
|
// Sert uniquement dans module telephonie
|
|
$yesno[0]="no";
|
|
$yesno[1]="yes";
|
|
|
|
if ( ! defined('MENTION_NPR') ) define('MENTION_NPR','(npr)');
|
|
?>
|