|
@@ -121,6 +121,25 @@ if (! defined('NOREQUIREDB'))
|
|
|
|
|
|
if ($db->error)
|
|
|
{
|
|
|
+ // If we were into a website context
|
|
|
+ if (! defined('USEDOLIBARREDITOR') && ! defined('USEDOLIBARRSERVER') && ! empty($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], DOL_DATA_ROOT.'/website') === 0))
|
|
|
+ {
|
|
|
+ $sapi_type = php_sapi_name();
|
|
|
+ if (substr($sapi_type, 0, 3) != 'cgi') http_response_code(503); // To tel search engine this is a temporary error
|
|
|
+ print '<div class="center" style="text-align: center; margin: 100px;">';
|
|
|
+ if (is_object($langs))
|
|
|
+ {
|
|
|
+ $langs->setDefaultLang('auto');
|
|
|
+ $langs->load("website");
|
|
|
+ print $langs->trans("SorryWebsiteIsCurrentlyOffLine");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ print "SorryWebsiteIsCurrentlyOffLine";
|
|
|
+ }
|
|
|
+ print '</div>';
|
|
|
+ exit;
|
|
|
+ }
|
|
|
dol_print_error($db, "host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
|
|
exit;
|
|
|
}
|