We apologize for this temporary unavailability.
'.
'Thank you for your understanding.
'),
20);
} else {
__error(__('Unable to connect to database')
,$e->getCode() == 0 ?
sprintf(__('This either means that the username and password information in '.
'your config.php file is incorrect or we can\'t contact '.
'the database server at "%s". This could mean your '.
'host\'s database server is down.
'.
'- Are you sure you have the correct username and password?
'.
'- Are you sure that you have typed the correct hostname?
'.
'- Are you sure that the database server is running?
'.
'If you\'re unsure what these terms mean you should probably contact '.
'your host. If you still need help you can always visit the '.
'Dotclear Support Forums.
').
(DC_DEBUG ?
__('The following error was encountered while trying to read the database:').'' : '')
,(DC_DBHOST != '' ? DC_DBHOST : 'localhost')
)
: ''
,20);
}
}
# If we have some __top_behaviors, we load them
if (isset($__top_behaviors) && is_array($__top_behaviors))
{
foreach ($__top_behaviors as $b) {
$core->addBehavior($b[0],$b[1]);
}
unset($b);
}
http::trimRequest();
try {
http::unsetGlobals();
} catch (Exception $e) {
header('Content-Type: text/plain');
echo $e->getMessage();
exit;
}
$core->url->registerDefault(array('dcUrlHandlers','home'));
$core->url->registerError(array('dcUrlHandlers','default404'));
$core->url->register('lang','','^([a-zA-Z]{2}(?:-[a-z]{2})?(?:/page/[0-9]+)?)$',array('dcUrlHandlers','lang'));
$core->url->register('post','post','^post/(.+)$',array('dcUrlHandlers','post'));
$core->url->register('preview','preview','^preview/(.+)$',array('dcUrlHandlers','preview'));
$core->url->register('category','category','^category/(.+)$',array('dcUrlHandlers','category'));
$core->url->register('archive','archive','^archive(/.+)?$',array('dcUrlHandlers','archive'));
$core->url->register('feed','feed','^feed/(.+)$',array('dcUrlHandlers','feed'));
$core->url->register('trackback','trackback','^trackback/(.+)$',array('dcUrlHandlers','trackback'));
$core->url->register('rsd','rsd','^rsd$',array('dcUrlHandlers','rsd'));
$core->url->register('xmlrpc','xmlrpc','^xmlrpc/(.+)$',array('dcUrlHandlers','xmlrpc'));
$core->setPostType('post','post.php?id=%d',$core->url->getURLFor('post','%s'));
# Store upload_max_filesize in bytes
$u_max_size = files::str2bytes(ini_get('upload_max_filesize'));
$p_max_size = files::str2bytes(ini_get('post_max_size'));
if ($p_max_size < $u_max_size) {
$u_max_size = $p_max_size;
}
define('DC_MAX_UPLOAD_SIZE',$u_max_size);
unset($u_max_size); unset($p_max_size);
# Shutdown
register_shutdown_function('__shutdown');
function __shutdown()
{
global $__shutdown;
if (is_array($__shutdown)) {
foreach ($__shutdown as $f) {
if (is_callable($f)) {
call_user_func($f);
}
}
}
# Explicitly close session before DB connection
try {
if (session_id()) {
session_write_close();
}
} catch (Exception $e) {}
$GLOBALS['core']->con->close();
}
function __error($summary,$message,$code=0)
{
# Error codes
# 10 : no config file
# 20 : database issue
# 30 : blog is not defined
# 40 : template files creation
# 50 : no default theme
# 60 : template processing error
# 70 : blog is offline
if (CLI_MODE)
{
trigger_error($summary,E_USER_ERROR);
exit(1);
}
else
{
if (defined('DC_ERRORFILE') && is_file(DC_ERRORFILE)) {
include DC_ERRORFILE;
} else {
include dirname(__FILE__).'/core_error.php';
}
exit;
}
}
function init_prepend_l10n()
{
# Loading locales for detected language
$dlang = http::getAcceptLanguages();
foreach($dlang as $l)
{
if ($l == 'en' || l10n::set(dirname(__FILE__).'/../locales/'.$l.'/main') !== false) {
break;
}
}
}
?>