m1k1oblog/common.php

39 lines
1,014 B
PHP
Raw Normal View History

2016-12-27 20:25:32 +00:00
<?php
// Define PROJECT PATH
2017-06-19 17:51:59 +00:00
define('PROJECT_PATH', dirname(__FILE__).'/');
define('APP_PATH', PROJECT_PATH.'app/');
2016-12-27 20:25:32 +00:00
// Load Autoloader
2017-06-19 17:51:59 +00:00
require APP_PATH."splclassloader.class.php";
2017-02-11 13:39:25 +00:00
$classLoader = new SplClassLoader(null, APP_PATH);
2016-12-27 20:25:32 +00:00
$classLoader->setFileExtension('.class.php');
$classLoader->register();
2019-12-20 17:32:04 +00:00
// In debug mode, display errors
if(Config::get_safe('debug', false)){
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
2019-12-26 19:43:22 +00:00
// Check extensions
2021-08-09 15:53:58 +00:00
$required = ['curl', 'PDO', 'pdo_mysql', 'gd', 'exif'];
2019-12-26 19:43:22 +00:00
$loaded = get_loaded_extensions();
if($missing = array_diff($required, $loaded)){
2021-02-21 18:03:33 +00:00
die("Missing extensions, please install: ".implode(", ", $missing));
2019-12-26 19:43:22 +00:00
}
2019-12-20 17:32:04 +00:00
}
2017-06-19 17:51:59 +00:00
// Language
Lang::load(empty($_GET["hl"]) ? Config::get("lang") : $_GET["hl"]);
2020-05-26 22:14:17 +00:00
// Timezone
2020-05-27 00:28:31 +00:00
if(false !== ($TZ = Config::get_safe('timezone', getenv('TZ')))) {
2020-05-26 22:14:17 +00:00
date_default_timezone_set($TZ);
ini_set('date.timezone', $TZ);
}
2016-12-27 20:25:32 +00:00
// Start session
2019-12-22 21:53:25 +00:00
ini_set('session.cookie_httponly', 1);
2019-12-26 19:43:22 +00:00
session_start();