-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
52 lines (45 loc) · 1.25 KB
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
class Config {
static $confArray;
public static function read($name) {
return self::$confArray[$name];
}
public static function write($name, $value) {
self::$confArray[$name] = $value;
}
public static function add($name, $value) {
if (!is_array(self::$confArray[$name])) return false;
array_push(self::$confArray[$name], $value);
}
}
require_once('config/database.php');
require_once('config/general.php');
class Core {
public $db;
private static $instance;
function __construct() {
$dsn = 'mysql:host='.Config::read('db.host').';dbname='.Config::read('db.name');
$user = Config::read('db.user');
$password = Config::read('db.password');
$this->db = new PDO($dsn, $user, $password);
}
public static function getInstance() {
if (!isset(self::$instance)) {
$object = __CLASS__;
self::$instance = new $object;
}
return self::$instance;
}
}
$core = Core::getInstance();
require_once('src/functions.php');
//Cookie handler
if (!isset($_COOKIE['theme'])) Config::write('cookie.theme', 'day');
else {
if (!in_array($_COOKIE['theme'], Config::read('gene.themes'))) Config::write('cookie.theme', 'day');
else Config::write('cookie.theme', $_COOKIE['theme']);
}
$content['page'] = "";
$content['title'] = "";
$content['desc'] = "";
?>