flash.moe/public/_v4/includes.php

59 lines
1.7 KiB
PHP
Raw Normal View History

2020-08-20 00:02:37 +00:00
<?php
define('FM_DEBUG',
is_file(__DIR__ . '/.debug')
|| $_SERVER['REMOTE_ADDR'] === '83.87.130.248'
|| substr($_SERVER['REMOTE_ADDR'], 0, 19) === '2001:1c02:20f:3200:'
);
error_reporting(FM_DEBUG ? -1 : 0);
ini_set('display_errors', FM_DEBUG ? 'On' : 'Off');
date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__);
require_once 'html.php';
try {
$pdo = new PDO('mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=flash_website;charset=utf8mb4', 'flash', 'af66a6666b1c9a597063325b14c8b52d', [
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => "
SET SESSION
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION',
time_zone = '+00:00';
",
]);
} catch(Exception $ex) {
echo '<h3>Unable to connect to database</h3>';
die($ex->getMessage());
}
define('HEAD_FLASHWAVE', [
'accent_colour' => '#4a3650',
]);
define('HEAD_ERROR', [
'accent_colour' => '#960018',
]);
define('HEAD_BLOG', [
'accent_colour' => '#4a3650',
'transitional' => true,
]);
define('HEAD_WHOIS', [
'accent_colour' => '#555',
'transitional' => true,
]);
define('NAV_FLASHWAVE', [
['title' => 'Home', 'link' => '/'],
['title' => 'Projects', 'link' => '/projects.php'],
]);
define('NAV_ERROR', [
['title' => 'Retry', 'link' => $_SERVER['REQUEST_URI']],
['title' => 'Home', 'link' => '/'],
]);
define('NAV_WHOIS', NAV_FLASHWAVE);