2008-11-12 01:26:54 +01:00
|
|
|
<?php
|
2009-02-09 01:50:38 +01:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2008-11-12 01:26:54 +01:00
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
2012-04-28 16:37:58 +02:00
|
|
|
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2008-11-12 01:26:54 +01: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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2008-11-12 01:26:54 +01:00
|
|
|
* (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
|
2011-08-01 01:19:04 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-11-12 01:26:54 +01:00
|
|
|
*/
|
|
|
|
|
|
2009-05-09 00:08:41 +02:00
|
|
|
/**
|
2012-01-29 20:57:40 +01:00
|
|
|
* \file htdocs/support/inc.php
|
|
|
|
|
* \ingroup core
|
|
|
|
|
* \brief File that define environment for support pages
|
2009-05-09 00:08:41 +02:00
|
|
|
*/
|
2008-11-12 01:26:54 +01:00
|
|
|
|
2013-05-30 19:29:08 +02:00
|
|
|
// Define DOL_DOCUMENT_ROOT
|
2011-09-07 15:27:50 +02:00
|
|
|
if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..');
|
2008-11-12 01:26:54 +01:00
|
|
|
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
2008-11-12 01:26:54 +01:00
|
|
|
|
2012-04-28 16:37:58 +02:00
|
|
|
// Avoid warnings with strict mode E_STRICT
|
|
|
|
|
$conf = new stdClass(); // instantiate $conf explicitely
|
2013-01-19 14:32:37 +01:00
|
|
|
$conf->global = new stdClass();
|
|
|
|
|
$conf->file = new stdClass();
|
|
|
|
|
$conf->db = new stdClass();
|
|
|
|
|
$conf->syslog = new stdClass();
|
2012-04-28 16:37:58 +02:00
|
|
|
|
|
|
|
|
// Force $_REQUEST["logtohtml"]
|
|
|
|
|
$_REQUEST["logtohtml"]=1;
|
2008-11-12 01:26:54 +01:00
|
|
|
|
|
|
|
|
// Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative
|
|
|
|
|
// et non path absolu.
|
|
|
|
|
if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"])
|
|
|
|
|
{
|
|
|
|
|
$_SERVER["PHP_SELF"]=$_SERVER["DOCUMENT_URI"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$includeconferror='';
|
2011-08-07 15:10:26 +02:00
|
|
|
|
2011-09-20 12:30:56 +02:00
|
|
|
// Define vars
|
2011-08-07 15:10:26 +02:00
|
|
|
$conffiletoshowshort = "conf.php";
|
2011-09-20 12:30:56 +02:00
|
|
|
// Define localization of conf file
|
2008-11-12 01:26:54 +01:00
|
|
|
$conffile = "../conf/conf.php";
|
2011-08-07 15:10:26 +02:00
|
|
|
$conffiletoshow = "htdocs/conf/conf.php";
|
2011-09-20 12:30:56 +02:00
|
|
|
// For debian/redhat like systems
|
|
|
|
|
//$conffile = "/etc/dolibarr/conf.php";
|
|
|
|
|
//$conffiletoshow = "/etc/dolibarr/conf.php";
|
2011-08-07 15:10:26 +02:00
|
|
|
|
2012-10-07 20:04:07 +02:00
|
|
|
|
2008-11-12 01:26:54 +01:00
|
|
|
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
|
|
|
|
{
|
2012-08-23 02:04:35 +02:00
|
|
|
$result=include_once $conffile; // Load conf file
|
2009-02-09 01:50:38 +01:00
|
|
|
if ($result)
|
2008-11-12 01:26:54 +01:00
|
|
|
{
|
2012-05-06 15:36:53 +02:00
|
|
|
|
2009-02-09 01:50:38 +01:00
|
|
|
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility
|
2012-05-06 15:36:53 +02:00
|
|
|
|
2012-04-28 16:37:58 +02:00
|
|
|
// Clean parameters
|
|
|
|
|
$dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):'';
|
|
|
|
|
$dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):'';
|
|
|
|
|
$dolibarr_main_url_root_alt =isset($dolibarr_main_url_root_alt)?trim($dolibarr_main_url_root_alt):'';
|
|
|
|
|
$dolibarr_main_document_root =isset($dolibarr_main_document_root)?trim($dolibarr_main_document_root):'';
|
|
|
|
|
$dolibarr_main_document_root_alt=isset($dolibarr_main_document_root_alt)?trim($dolibarr_main_document_root_alt):'';
|
2009-02-09 01:50:38 +01:00
|
|
|
|
2008-11-12 01:26:54 +01:00
|
|
|
// Remove last / or \ on directories or url value
|
2009-10-21 20:14:00 +02:00
|
|
|
if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
|
|
|
|
|
if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root);
|
|
|
|
|
if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/','',$dolibarr_main_data_root);
|
2012-04-28 16:37:58 +02:00
|
|
|
if (! empty($dolibarr_main_document_root_alt) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root_alt);
|
|
|
|
|
if (! empty($dolibarr_main_url_root_alt) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root_alt);
|
2012-05-06 15:36:53 +02:00
|
|
|
|
2008-11-12 01:26:54 +01:00
|
|
|
// Create conf object
|
|
|
|
|
if (! empty($dolibarr_main_document_root))
|
|
|
|
|
{
|
|
|
|
|
$result=conf($dolibarr_main_document_root);
|
|
|
|
|
}
|
|
|
|
|
// Load database driver
|
|
|
|
|
if ($result)
|
|
|
|
|
{
|
|
|
|
|
if (! empty($dolibarr_main_document_root) && ! empty($dolibarr_main_db_type))
|
|
|
|
|
{
|
2012-08-23 02:04:35 +02:00
|
|
|
$result=include_once $dolibarr_main_document_root . "/core/db/".$dolibarr_main_db_type.'.class.php';
|
2011-09-28 16:26:49 +02:00
|
|
|
if (! $result)
|
2008-11-12 01:26:54 +01:00
|
|
|
{
|
|
|
|
|
$includeconferror='ErrorBadValueForDolibarrMainDBType';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-02-09 01:50:38 +01:00
|
|
|
$includeconferror='ErrorBadValueForDolibarrMainDocumentRoot';
|
2008-11-12 01:26:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-02-09 01:50:38 +01:00
|
|
|
$includeconferror='ErrorBadFormatForConfFile';
|
2008-11-12 01:26:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-04-28 16:37:58 +02:00
|
|
|
$conf->global->MAIN_LOGTOHTML = 1;
|
2008-11-12 01:26:54 +01:00
|
|
|
|
2009-06-29 16:29:14 +02:00
|
|
|
// Define prefix
|
2009-02-09 01:50:38 +01:00
|
|
|
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
2008-11-12 01:26:54 +01:00
|
|
|
define('MAIN_DB_PREFIX',(isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:''));
|
2009-06-29 16:29:14 +02:00
|
|
|
|
2012-04-28 16:37:58 +02:00
|
|
|
define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
|
2008-11-12 01:26:54 +01:00
|
|
|
define('DOL_DATA_ROOT',(isset($dolibarr_main_data_root)?$dolibarr_main_data_root:''));
|
2012-04-28 16:37:58 +02:00
|
|
|
define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root
|
|
|
|
|
$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
|
|
|
|
$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
|
|
|
|
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
|
|
|
|
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
|
|
|
|
|
2012-05-06 15:36:53 +02:00
|
|
|
if (empty($character_set_client)) $character_set_client="UTF-8";
|
|
|
|
|
$conf->file->character_set_client=strtoupper($character_set_client);
|
|
|
|
|
if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($conf->db->type=='mysql'?'latin1':''); // Old installation
|
|
|
|
|
$conf->db->character_set=$dolibarr_main_db_character_set;
|
|
|
|
|
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($conf->db->type=='mysql'?'latin1_swedish_ci':''); // Old installation
|
|
|
|
|
$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation;
|
|
|
|
|
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
|
|
|
|
|
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
|
|
|
|
|
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
|
|
|
|
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
|
2012-04-28 16:37:58 +02:00
|
|
|
|
2008-11-12 01:26:54 +01:00
|
|
|
if (empty($conf->db->user)) $conf->db->user='';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Defini objet langs
|
2008-12-08 01:04:11 +01:00
|
|
|
$langs = new Translate('..',$conf);
|
2011-04-26 23:06:45 +02:00
|
|
|
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang'));
|
2009-05-10 15:55:23 +02:00
|
|
|
else $langs->setDefaultLang('auto');
|
2008-11-12 01:26:54 +01:00
|
|
|
|
|
|
|
|
$bc[false]=' class="bg1"';
|
|
|
|
|
$bc[true]=' class="bg2"';
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
/**
|
2012-01-04 21:47:40 +01:00
|
|
|
* Load conf file (file must exists)
|
|
|
|
|
*
|
|
|
|
|
* @param string $dolibarr_main_document_root Root directory of Dolibarr bin files
|
|
|
|
|
* @return int <0 if KO, >0 if OK
|
2009-05-09 20:00:14 +02:00
|
|
|
*/
|
2008-11-12 01:26:54 +01:00
|
|
|
function conf($dolibarr_main_document_root)
|
|
|
|
|
{
|
|
|
|
|
global $conf;
|
|
|
|
|
global $dolibarr_main_db_type;
|
|
|
|
|
global $dolibarr_main_db_host;
|
|
|
|
|
global $dolibarr_main_db_port;
|
|
|
|
|
global $dolibarr_main_db_name;
|
|
|
|
|
global $dolibarr_main_db_user;
|
|
|
|
|
global $dolibarr_main_db_pass;
|
|
|
|
|
global $character_set_client;
|
|
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
$return=include_once $dolibarr_main_document_root.'/core/class/conf.class.php';
|
2009-05-09 20:00:14 +02:00
|
|
|
if (! $return) return -1;
|
2008-11-12 01:26:54 +01:00
|
|
|
|
|
|
|
|
$conf=new Conf();
|
|
|
|
|
$conf->db->type = trim($dolibarr_main_db_type);
|
|
|
|
|
$conf->db->host = trim($dolibarr_main_db_host);
|
|
|
|
|
$conf->db->port = trim($dolibarr_main_db_port);
|
|
|
|
|
$conf->db->name = trim($dolibarr_main_db_name);
|
|
|
|
|
$conf->db->user = trim($dolibarr_main_db_user);
|
|
|
|
|
$conf->db->pass = trim($dolibarr_main_db_pass);
|
|
|
|
|
|
2012-05-06 15:36:53 +02:00
|
|
|
if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='utf8_general_ci';
|
2008-11-12 01:26:54 +01:00
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
/**
|
2012-04-28 16:37:58 +02:00
|
|
|
* Show HTML header
|
2011-12-04 22:25:49 +01:00
|
|
|
*
|
2012-04-28 16:37:58 +02:00
|
|
|
* @param string $soutitre Title
|
|
|
|
|
* @param string $next Next
|
|
|
|
|
* @param string $action Action code
|
|
|
|
|
* @return void
|
2009-05-09 20:00:14 +02:00
|
|
|
*/
|
2008-11-12 01:26:54 +01:00
|
|
|
function pHeader($soutitre,$next,$action='none')
|
|
|
|
|
{
|
|
|
|
|
global $conf;
|
2009-05-09 20:00:14 +02:00
|
|
|
global $langs;
|
|
|
|
|
$langs->load("main");
|
|
|
|
|
$langs->load("admin");
|
2008-11-12 01:26:54 +01:00
|
|
|
|
|
|
|
|
// On force contenu dans format sortie
|
2009-05-08 03:11:04 +02:00
|
|
|
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
2008-11-12 01:26:54 +01:00
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
2013-05-21 14:41:11 +02:00
|
|
|
print '<html manifest="'.DOL_URL_ROOT.'/cache.manifest">'."\n";
|
2009-05-09 20:00:14 +02:00
|
|
|
print '<head>'."\n";
|
|
|
|
|
print '<meta http-equiv="content-type" content="text/html; charset='.$conf->file->character_set_client.'">'."\n";
|
2009-06-15 22:49:51 +02:00
|
|
|
print '<meta name="robots" content="index,follow">'."\n";
|
|
|
|
|
print '<meta name="keywords" content="help, center, dolibarr, doliwamp">'."\n";
|
|
|
|
|
print '<meta name="description" content="Dolibarr help center">'."\n";
|
2009-05-09 20:00:14 +02:00
|
|
|
print '<link rel="stylesheet" type="text/css" href="default.css">'."\n";
|
2009-06-15 22:49:51 +02:00
|
|
|
print '<title>'.$langs->trans("DolibarrHelpCenter").'</title>'."\n";
|
2009-05-09 20:00:14 +02:00
|
|
|
print '</head>'."\n";
|
2009-06-03 21:55:39 +02:00
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
print '<body>'."\n";
|
2009-06-03 21:55:39 +02:00
|
|
|
|
|
|
|
|
print '<table class="noborder" summary="helpcentertitle"><tr valign="middle">';
|
2009-05-10 15:55:23 +02:00
|
|
|
print '<td width="20">';
|
2009-08-09 22:35:23 +02:00
|
|
|
print '<img src="helpcenter.png" alt="logohelpcenter">';
|
2009-05-10 15:55:23 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '<td>';
|
2009-05-09 20:00:14 +02:00
|
|
|
print '<span class="titre">'.$soutitre.'</span>'."\n";
|
2009-05-10 15:55:23 +02:00
|
|
|
print '</td></tr></table>';
|
2008-11-12 01:26:54 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
/**
|
2012-04-28 16:37:58 +02:00
|
|
|
* Print HTML footer
|
2009-05-09 20:00:14 +02:00
|
|
|
*
|
2012-01-04 21:47:40 +01:00
|
|
|
* @param string $nonext No button "Next step"
|
|
|
|
|
* @param string $setuplang Language code
|
|
|
|
|
* @return void
|
2009-05-09 20:00:14 +02:00
|
|
|
*/
|
2008-11-12 01:26:54 +01:00
|
|
|
function pFooter($nonext=0,$setuplang='')
|
|
|
|
|
{
|
2009-05-09 20:00:14 +02:00
|
|
|
global $langs;
|
|
|
|
|
$langs->load("main");
|
|
|
|
|
$langs->load("admin");
|
2009-02-09 01:50:38 +01:00
|
|
|
|
2009-05-09 20:00:14 +02:00
|
|
|
print '</body>'."\n";
|
|
|
|
|
print '</html>'."\n";
|
2008-11-12 01:26:54 +01:00
|
|
|
}
|
|
|
|
|
|
2012-05-06 15:36:53 +02:00
|
|
|
?>
|