2017-07-20 14:49:20 +00:00
< ? php
2024-06-15 14:02:47 +00:00
/* Copyright ( C ) 2017 - 2024 Laurent Destailleur < eldy @ users . sourceforge . net >
2025-01-06 20:10:21 +00:00
* Copyright ( C ) 2024 - 2025 Frédéric France < frederic . france @ free . fr >
2026-02-12 15:29:11 +00:00
* Copyright ( C ) 2026 MDW < mdeweerd @ users . noreply . github . com >
2017-07-20 14:49:20 +00: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 3 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
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
* or see https :// www . gnu . org /
2017-07-20 14:49:20 +00:00
*/
/**
* \file htdocs / core / website . inc . php
2024-03-29 22:59:23 +00:00
* \brief Common file loaded by all website pages ( after master . inc . php ) . It sets the new object $weblangs .
* This file is included in top of all container pages ( in edit mode , in dolibarr web server mode and in external web server mode ) .
* It is run only when a web page is called .
2018-09-25 14:35:59 +00:00
* The global variable $websitekey must be defined .
2017-07-20 14:49:20 +00:00
*/
2025-10-18 23:56:26 +00:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
*
* @ var string $websitekey
*/
2017-07-20 14:49:20 +00:00
2018-10-03 18:58:45 +00:00
// Load website class
2017-10-20 21:48:42 +00:00
include_once DOL_DOCUMENT_ROOT . '/website/class/website.class.php' ;
2019-04-30 11:50:03 +00:00
include_once DOL_DOCUMENT_ROOT . '/website/class/websitepage.class.php' ;
2022-03-16 14:56:39 +00:00
$website = null ;
$websitepage = null ;
$weblangs = null ;
$pagelangs = null ;
2020-05-15 16:41:46 +00:00
// Detection browser (copy of code from main.inc.php)
2021-02-23 21:03:23 +00:00
if ( isset ( $_SERVER [ " HTTP_USER_AGENT " ]) && is_object ( $conf ) && empty ( $conf -> browser -> name )) {
2020-05-15 16:41:46 +00:00
$tmp = getBrowserInfo ( $_SERVER [ " HTTP_USER_AGENT " ]);
$conf -> browser -> name = $tmp [ 'browsername' ];
$conf -> browser -> os = $tmp [ 'browseros' ];
$conf -> browser -> version = $tmp [ 'browserversion' ];
$conf -> browser -> layout = $tmp [ 'layout' ]; // 'classic', 'phone', 'tablet'
//var_dump($conf->browser);
2021-02-23 21:03:23 +00:00
if ( $conf -> browser -> layout == 'phone' ) {
$conf -> dol_no_mouse_hover = 1 ;
}
2020-05-15 16:41:46 +00:00
}
2018-10-15 23:39:04 +00:00
// Define $website
2024-06-15 14:02:47 +00:00
if ( is_null ( $website )) {
2019-12-09 09:35:58 +00:00
$website = new Website ( $db );
2019-01-27 10:55:16 +00:00
$website -> fetch ( 0 , $websitekey );
2018-10-03 18:58:45 +00:00
}
2018-10-15 23:39:04 +00:00
// Define $websitepage if we have $websitepagefile defined
2023-03-09 17:12:17 +00:00
if ( empty ( $pageid ) && ! empty ( $websitepagefile )) {
2018-10-15 23:39:04 +00:00
$pageid = str_replace ( array ( '.tpl.php' , 'page' ), array ( '' , '' ), basename ( $websitepagefile ));
2021-02-23 21:03:23 +00:00
if ( $pageid == 'index.php' ) {
$pageid = $website -> fk_default_home ;
}
2019-04-30 11:50:03 +00:00
}
2024-06-15 14:02:47 +00:00
if ( is_null ( $websitepage )) {
2020-10-31 13:32:18 +00:00
$websitepage = new WebsitePage ( $db );
2018-10-15 23:39:04 +00:00
}
2020-05-08 12:25:49 +00:00
// Define $weblangs
2024-06-15 14:02:47 +00:00
if ( is_null ( $weblangs )) {
2020-05-08 12:35:03 +00:00
$weblangs = new Translate ( '' , $conf );
2020-05-08 12:25:49 +00:00
}
2024-06-15 14:02:47 +00:00
if ( is_null ( $pagelangs )) {
2020-05-15 17:01:12 +00:00
$pagelangs = new Translate ( '' , $conf );
}
2024-02-25 15:57:45 +00:00
if ( ! empty ( $pageid ) && $pageid > 0 ) {
2018-10-15 23:39:04 +00:00
$websitepage -> fetch ( $pageid );
2019-11-12 12:55:46 +00:00
2024-03-29 22:59:23 +00:00
// Rule to define weblang of visitor:
// 1 - Take parameter lang
// 2 - Cookie lang of website (set by a possible js lang selector)
// 3 - XX/... found in url page
// 4 - auto (so web browser lang)
$srclang = GETPOSTISSET ( 'lang' ) ? GETPOST ( 'lang' , 'aZ09' ) : '' ;
if ( empty ( $srclang )) {
$srclang = ( empty ( $_COOKIE [ 'weblangs-shortcode' ]) ? '' : preg_replace ( '/[^a-zA-Z0-9_\-]/' , '' , $_COOKIE [ 'weblangs-shortcode' ]));
}
if ( empty ( $srclang )) {
$reg = array ();
2024-03-29 23:18:42 +00:00
// With Dolibarr server, url is in parameter pageref
if ( defined ( 'USEDOLIBARRSERVER' ) && ! empty ( $_GET [ 'pageref' ]) && preg_match ( '/^\/?(\w\w)\//' , $_GET [ 'pageref' ], $reg ) && $reg [ 1 ] != 'js' ) { // We reuse $_GET['pageref'] because $pageref may have been cleaned already from the language code.
$srclang = $reg [ 1 ];
}
// With External server, url is in parameter pageref
if ( defined ( 'USEEXTERNALSERVER' ) && ! empty ( $_SERVER [ 'PHP_SELF' ]) && preg_match ( '/^\/?(\w\w)\//' , $_SERVER [ 'PHP_SELF' ], $reg ) && $reg [ 1 ] != 'js' ) {
2024-03-29 22:59:23 +00:00
$srclang = $reg [ 1 ];
}
}
if ( empty ( $srclang )) {
2026-02-12 15:29:11 +00:00
$srclang = 'auto' ;
2024-03-29 22:59:23 +00:00
}
$weblangs -> setDefaultLang ( $srclang );
2020-05-15 17:01:12 +00:00
$pagelangs -> setDefaultLang ( $websitepage -> lang ? $websitepage -> lang : $weblangs -> shortlang );
2020-05-08 12:25:49 +00:00
2025-05-09 22:05:36 +00:00
if ( ! defined ( 'USEDOLIBARREDITOR' ) && ( in_array ( $websitepage -> type_container , array ( 'menu' , 'setup' , 'other' )) || empty ( $websitepage -> status ) && ! defined ( 'USEDOLIBARRSERVER' ))) {
2019-11-12 12:55:46 +00:00
$weblangs -> load ( " website " );
2022-09-09 11:58:54 +00:00
// Security options
// X-Content-Type-Options
header ( " X-Content-Type-Options: nosniff " );
// X-Frame-Options
2023-11-27 10:39:32 +00:00
if ( empty ( $websitepage -> allowed_in_frames ) && ! getDolGlobalString ( 'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES' )) {
2022-09-09 11:58:54 +00:00
header ( " X-Frame-Options: SAMEORIGIN " );
}
//httponly_accessforbidden('<center><br><br>'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'</center>', 404, 1);
2019-11-12 12:55:46 +00:00
http_response_code ( 404 );
2020-06-09 20:43:37 +00:00
print '<center><br><br>' . $weblangs -> trans ( " YouTryToAccessToAFileThatIsNotAWebsitePage " , $websitepage -> pageurl , $websitepage -> type_container , $websitepage -> status ) . '</center>' ;
2019-11-12 12:55:46 +00:00
exit ;
}
2018-10-15 23:39:04 +00:00
}
2018-10-14 16:44:29 +00:00
2019-12-09 09:35:58 +00:00
if ( ! defined ( 'USEDOLIBARRSERVER' ) && ! defined ( 'USEDOLIBARREDITOR' )) {
2022-08-16 13:19:21 +00:00
// Security options
// X-Content-Type-Options
2019-12-07 10:51:21 +00:00
header ( " X-Content-Type-Options: nosniff " );
2022-08-16 13:19:21 +00:00
// X-Frame-Options
2023-11-27 10:39:32 +00:00
if ( empty ( $websitepage -> allowed_in_frames ) && ! getDolGlobalString ( 'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES' )) {
2019-12-07 14:46:14 +00:00
header ( " X-Frame-Options: SAMEORIGIN " );
}
2022-08-16 13:19:21 +00:00
// X-XSS-Protection
//header("X-XSS-Protection: 1"); // XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated.
2023-02-28 09:39:39 +00:00
// Content-Security-Policy-Report-Only
2025-02-14 10:13:39 +00:00
if ( ! defined ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCECSPRO' )) {
2023-02-28 09:39:39 +00:00
// A default security policy that keep usage of js external component like ckeditor, stripe, google, working
// For example: to restrict to only local resources, except for css (cloudflare+google), and js (transifex + google tags) and object/iframe (youtube)
// default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;
// For example, to restrict everything to itself except img that can be on other servers:
// default-src 'self'; img-src *;
// Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins:
// default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none'
//
2023-03-01 22:50:02 +00:00
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';";
2025-02-14 10:13:39 +00:00
$contentsecuritypolicy = getDolGlobalString ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCECSPRO' );
2023-02-28 09:39:39 +00:00
if ( ! is_object ( $hookmanager )) {
2023-03-26 15:59:28 +00:00
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php' ;
2023-02-28 09:39:39 +00:00
$hookmanager = new HookManager ( $db );
}
$hookmanager -> initHooks ( array ( " main " ));
2026-02-12 15:29:11 +00:00
$parameters = array ( 'contentsecuritypolicy' => $contentsecuritypolicy , 'mode' => 'reportonly' );
2023-02-28 09:39:39 +00:00
$result = $hookmanager -> executeHooks ( 'setContentSecurityPolicy' , $parameters ); // Note that $action and $object may have been modified by some hooks
if ( $result > 0 ) {
$contentsecuritypolicy = $hookmanager -> resPrint ; // Replace CSP
} else {
$contentsecuritypolicy .= $hookmanager -> resPrint ; // Concat CSP
}
if ( ! empty ( $contentsecuritypolicy )) {
header ( " Content-Security-Policy-Report-Only: " . $contentsecuritypolicy );
}
}
2022-08-16 13:19:21 +00:00
// Content-Security-Policy
2025-02-10 09:27:06 +00:00
if ( ! defined ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCECSP' )) {
2022-08-16 13:19:21 +00:00
// A default security policy that keep usage of js external component like ckeditor, stripe, google, working
2023-02-28 09:39:39 +00:00
// For example: to restrict to only local resources, except for css (cloudflare+google), and js (transifex + google tags) and object/iframe (youtube)
// default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;
// For example, to restrict everything to itself except img that can be on other servers:
// default-src 'self'; img-src *;
// Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins:
// default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none'
//
2023-03-01 22:50:02 +00:00
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';";
2025-02-10 09:27:06 +00:00
$contentsecuritypolicy = getDolGlobalString ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCECSP' );
2022-08-16 13:19:21 +00:00
if ( ! is_object ( $hookmanager )) {
2023-03-26 15:59:28 +00:00
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php' ;
2022-08-16 13:19:21 +00:00
$hookmanager = new HookManager ( $db );
}
$hookmanager -> initHooks ( array ( " main " ));
2026-02-12 15:29:11 +00:00
$parameters = array ( 'contentsecuritypolicy' => $contentsecuritypolicy , 'mode' => 'active' );
2022-08-16 13:19:21 +00:00
$result = $hookmanager -> executeHooks ( 'setContentSecurityPolicy' , $parameters ); // Note that $action and $object may have been modified by some hooks
if ( $result > 0 ) {
$contentsecuritypolicy = $hookmanager -> resPrint ; // Replace CSP
} else {
$contentsecuritypolicy .= $hookmanager -> resPrint ; // Concat CSP
}
if ( ! empty ( $contentsecuritypolicy )) {
header ( " Content-Security-Policy: " . $contentsecuritypolicy );
}
}
2022-08-16 13:49:29 +00:00
// Referrer-Policy
2025-02-10 09:27:06 +00:00
if ( ! defined ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCERP' )) {
2022-08-16 14:06:09 +00:00
// The constant WEBSITE_MAIN_SECURITY_FORCERP should never be defined by page, but the variable used just after may be
2022-08-16 13:49:29 +00:00
// For public web sites, we use the same default value than "strict-origin-when-cross-origin"
2025-02-10 09:27:06 +00:00
$referrerpolicy = getDolGlobalString ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCERP' , " strict-origin-when-cross-origin " );
2022-08-16 13:49:29 +00:00
header ( " Referrer-Policy: " . $referrerpolicy );
}
2022-08-16 14:06:09 +00:00
// Strict-Transport-Security
2025-02-10 09:27:06 +00:00
if ( ! defined ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCESTS' )) {
2022-08-16 14:06:09 +00:00
// The constant WEBSITE_MAIN_SECURITY_FORCESTS should never be defined by page, but the variable used just after may be
2022-08-16 14:58:28 +00:00
// Example: "max-age=31536000; includeSubDomains"
2025-02-10 09:27:06 +00:00
$sts = getDolGlobalString ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCESTS' );
2022-08-16 14:06:09 +00:00
if ( ! empty ( $sts )) {
header ( " Strict-Transport-Security: " . $sts );
}
}
2022-08-16 14:58:28 +00:00
// Permissions-Policy (old name was Feature-Policy)
2025-02-10 09:27:06 +00:00
if ( ! defined ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCEPP' )) {
2022-08-16 14:58:28 +00:00
// The constant WEBSITE_MAIN_SECURITY_FORCEPP should never be defined by page, but the variable used just after may be
// Example: "camera: 'none'; microphone: 'none';"
2025-02-10 09:27:06 +00:00
$pp = getDolGlobalString ( 'WEBSITE_' . $website -> id . '_SECURITY_FORCEPP' );
2022-08-16 14:58:28 +00:00
if ( ! empty ( $pp )) {
header ( " Permissions-Policy: " . $pp );
}
}
2019-12-07 10:51:21 +00:00
}
2018-10-14 16:44:29 +00:00
// A lang was forced, so we change weblangs init
2021-02-23 21:03:23 +00:00
if ( GETPOST ( 'l' , 'aZ09' )) {
$weblangs -> setDefaultLang ( GETPOST ( 'l' , 'aZ09' ));
}
2018-10-14 16:44:29 +00:00
// A lang was forced, so we check to find if we must make a redirect on translation page
2021-02-23 21:03:23 +00:00
if ( $_SERVER [ 'PHP_SELF' ] != DOL_URL_ROOT . '/website/index.php' ) { // If we browsing page using Dolibarr server or a Native web server
2018-10-14 18:04:25 +00:00
//print_r(get_defined_constants(true));exit;
2021-02-23 21:03:23 +00:00
if ( GETPOST ( 'l' , 'aZ09' )) {
2019-12-09 09:35:58 +00:00
$sql = " SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " website_page as wp " ;
2021-03-30 15:53:25 +00:00
$sql .= " WHERE wp.fk_website = " . (( int ) $website -> id );
2026-07-13 10:13:35 +00:00
if ( ! empty ( $pageid )) {
$sql .= " AND (wp.fk_page = " . (( int ) $pageid ) . " OR wp.rowid = " . (( int ) $pageid );
} else {
$sql .= " AND (0 " ;
}
2021-02-23 21:03:23 +00:00
if ( is_object ( $websitepage ) && $websitepage -> fk_page > 0 ) {
2021-08-23 17:33:24 +00:00
$sql .= " OR wp.fk_page = " . (( int ) $websitepage -> fk_page ) . " OR wp.rowid = " . (( int ) $websitepage -> fk_page );
2021-02-23 21:03:23 +00:00
}
2019-12-09 09:35:58 +00:00
$sql .= " ) " ;
$sql .= " AND wp.lang = ' " . $db -> escape ( GETPOST ( 'l' , 'aZ09' )) . " ' " ;
2018-10-14 21:26:57 +00:00
2018-10-15 23:39:04 +00:00
$resql = $db -> query ( $sql );
2021-02-23 21:03:23 +00:00
if ( $resql ) {
2018-10-15 23:39:04 +00:00
$obj = $db -> fetch_object ( $resql );
2021-02-23 21:03:23 +00:00
if ( $obj ) {
2018-10-15 23:39:04 +00:00
$newpageid = $obj -> rowid ;
2021-02-23 21:03:23 +00:00
if ( $newpageid != $pageid ) { // To avoid to make a redirect on same page (infinite loop)
2018-10-15 23:39:04 +00:00
if ( defined ( 'USEDOLIBARRSERVER' )) {
2019-01-27 10:55:16 +00:00
header ( " Location: " . DOL_URL_ROOT . '/public/website/index.php?website=' . $websitekey . '&pageid=' . $newpageid . '&l=' . GETPOST ( 'l' , 'aZ09' ));
2018-10-15 23:39:04 +00:00
exit ;
2020-05-21 13:05:19 +00:00
} else {
2018-10-15 23:39:04 +00:00
$newpageref = $obj -> pageurl ;
2020-06-06 18:37:17 +00:00
header ( " Location: " . (( $obj -> lang && $obj -> lang != $website -> lang ) ? '/' . $obj -> lang . '/' : '/' ) . $newpageref . '.php?l=' . GETPOST ( 'l' , 'aZ09' ));
2018-10-15 23:39:04 +00:00
exit ;
2018-10-14 18:04:25 +00:00
}
2018-10-14 16:44:29 +00:00
}
}
}
}
}
2019-08-13 03:03:45 +00:00
2022-09-09 11:58:54 +00:00
// Show off line message when all website is off
2021-02-23 21:03:23 +00:00
if ( ! defined ( 'USEDOLIBARREDITOR' ) && empty ( $website -> status )) {
2022-09-09 11:58:54 +00:00
// Security options
// X-Content-Type-Options
header ( " X-Content-Type-Options: nosniff " );
// X-Frame-Options
2023-11-27 10:39:32 +00:00
if ( empty ( $websitepage -> allowed_in_frames ) && ! getDolGlobalString ( 'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES' )) {
2022-09-09 11:58:54 +00:00
header ( " X-Frame-Options: SAMEORIGIN " );
}
2019-08-13 03:03:45 +00:00
$weblangs -> load ( " website " );
2022-09-09 11:58:54 +00:00
//httponly_accessforbidden('<center><br><br>'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'</center>', 503, 1);
2019-08-13 04:37:06 +00:00
http_response_code ( 503 );
2019-08-13 03:03:45 +00:00
print '<center><br><br>' . $weblangs -> trans ( " SorryWebsiteIsCurrentlyOffLine " ) . '</center>' ;
exit ;
}
2024-03-14 21:06:43 +00:00
// Get session info and obfuscate session cookie and other variables
$prefix = dol_getprefix ( '' );
$sessionname = 'DOLSESSID_' . $prefix ;
//$savsessionid = $_COOKIE[$sessionname];
2026-02-11 20:07:06 +00:00
// Add a protection if custom PHP is not allowed or allowed with conditions
global $dolibarr_website_allow_custom_php ;
2026-04-20 16:19:16 +00:00
$notdisabledsystemfunction = '' ;
$systemfunctions = array ( " exec " , " passthru " , " shell_exec " , " system " , " popen " , " proc_open " );
foreach ( $systemfunctions as $systemfunction ) {
// @phpstan-ignore-next-line
if ( function_exists ( $systemfunction )) {
$notdisabledsystemfunction .= ( $notdisabledsystemfunction ? ', ' : '' ) . $systemfunction ;
2026-02-11 20:07:06 +00:00
}
}
2026-04-20 16:19:16 +00:00
if ( empty ( $dolibarr_website_allow_custom_php ) || ( $dolibarr_website_allow_custom_php == 1 && $notdisabledsystemfunction )) {
print '<center><br><br>' ;
2026-04-20 20:20:19 +00:00
print 'Website features are DISABLED if the PHP system functions (' . implode ( ',' , $systemfunctions ) . ') are NOT disabled for the website context.<br>' ;
2026-04-20 16:19:16 +00:00
print 'The value "' . $notdisabledsystemfunction . '" has NOT been found into the php parameter <b>current disable_functions</b> ' ;
//print '<textarea cols="100" rows="5">';
$form = new Form ( $db );
print $form -> textwithpicto ( '' , 'Current value for disable_functions = ' . ini_get ( 'disable_functions' ));
print '<br>' ;
//print ini_get('disable_functions'); // Warning, the real value may not be this one.Only the master initial value from php.ini is effective, not the local value set at virtualhost.
//print (implode(', ', explode(',', (string) ini_get('disable_functions'))));
//print '</textarea>';
print '<br><br>' ;
print 'You can fix this by changing setup of your PHP ini (changing this in a virtual host with php_admin_value is not effective):<br>' ;
print 'disable_functions="exec,passthru,shell_exec,system,popen,proc_open,..."<br>' ;
print 'but WARNING, this will break this 3 features for:<br>' ;
print '- 1) Cron tasks calling command line tools.<br>' ;
print '- 2) Internal backup feature running the database dump tool.<br>' ;
print '- 3) Command line antivirus check ran when uploading a file.<br>' ;
print '<br>' ;
print 'If you don\'t use this 3 feature, you can change your php.ini to exclude the exec functions.<br>If you need at least one, you can bypass this protection by setting $dolibarr_website_allow_custom_php to 2 in your dolibarr config file (Add RCE protection like AppArmor or SELinux in this case).' ;
print '</center>' ;
exit ; // Stop here to PHP later won't be executed
}
2026-02-11 20:07:06 +00:00
2024-03-14 21:06:43 +00:00
$_COOKIE [ $sessionname ] = 'obfuscatedcookie' ;
unset ( $conf -> file -> instance_unique_id );
2024-03-14 22:23:38 +00:00
unset ( $dolibarr_main_instance_unique_id );
2026-03-29 19:14:09 +00:00
unset ( $dolibarr_main_dolcrypt_key );
2026-02-08 16:41:42 +00:00
2024-03-14 22:23:38 +00:00
unset ( $dolibarr_main_db_host );
unset ( $dolibarr_main_db_port );
unset ( $dolibarr_main_db_name );
unset ( $dolibarr_main_db_user );
unset ( $dolibarr_main_db_pass );
2025-01-06 20:10:21 +00:00
unset ( $dolibarr_main_db_type );
2024-03-14 22:23:38 +00:00
unset ( $dolibarr_main_document_root );
unset ( $dolibarr_main_document_root_alt );