Example #1
0
}
if (CONFIG_ENFORCESSL) {
    header('Strict-Transport-Security: max-age=10886400; includeSubDomains; preload');
}
if (!ENV_SSL && CONFIG_ENFORCESSL) {
    if (!isset($_SERVER['HTTP_USER_AGENT']) || stripos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider') === false && stripos($_SERVER['HTTP_USER_AGENT'], 'Sogou web spider') === false && stripos($_SERVER['HTTP_USER_AGENT'], 'Sosospider') === false) {
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: https://' . CONFIG_HOST . $_SERVER['REQUEST_URI']);
        exit;
    }
}
// Charset & XSS Protection
header('Content-Type: text/html; charset=UTF-8');
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
// Multi-byte
mb_internal_encoding('UTF-8');
// Debug
if (CONFIG_DEBUG) {
    error_reporting(E_ALL | E_STRICT);
    \BWBlog\Service\Whoops::initialize();
} else {
    error_reporting(0);
}
// Buffer
ob_start();
// Timezone
date_default_timezone_set(CONFIG_TIMEZONE);
// Database
\BWBlog\Service\Database::initMongoDB();