2021-11-12 15:23:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* index.php
|
|
|
|
*
|
|
|
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include
|
|
|
|
*/
|
|
|
|
require 'includes/functions/auto-include.php';
|
|
|
|
|
|
|
|
autoInclude(__DIR__ . '/includes/classes');
|
|
|
|
autoInclude(__DIR__ . '/includes/functions');
|
|
|
|
|
|
|
|
/**
|
2021-11-15 11:33:38 +00:00
|
|
|
* Config
|
2021-11-12 15:23:48 +00:00
|
|
|
*/
|
|
|
|
$configPath = 'includes/config/config.php';
|
|
|
|
|
2021-11-15 11:33:38 +00:00
|
|
|
if (file_exists($configPath)) {
|
|
|
|
require $configPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Database
|
|
|
|
*/
|
|
|
|
$database = false;
|
|
|
|
|
|
|
|
if (
|
|
|
|
defined('DATABASE_HOST')
|
|
|
|
&& defined('DATABASE_NAME')
|
|
|
|
&& defined('DATABASE_USER')
|
|
|
|
&& defined('DATABASE_PASSWORD')
|
|
|
|
) {
|
|
|
|
$database = new wishthis\Database(
|
|
|
|
DATABASE_HOST,
|
|
|
|
DATABASE_NAME,
|
|
|
|
DATABASE_USER,
|
|
|
|
DATABASE_PASSWORD
|
|
|
|
);
|
2021-11-12 15:23:48 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 11:33:38 +00:00
|
|
|
/**
|
|
|
|
* Install
|
|
|
|
*/
|
|
|
|
if ($database) {
|
|
|
|
try {
|
|
|
|
$database->getOption('isInstalled');
|
|
|
|
} catch (\Throwable $th) {
|
|
|
|
$page = 'install';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Session
|
|
|
|
*/
|
|
|
|
session_start();
|
|
|
|
|
2021-11-12 15:23:48 +00:00
|
|
|
/**
|
|
|
|
* Page
|
|
|
|
*/
|
|
|
|
if (!isset($page)) {
|
|
|
|
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
|
|
|
|
}
|
|
|
|
$pagePath = 'includes/pages/' . $page . '.php';
|
|
|
|
|
2021-11-15 11:33:38 +00:00
|
|
|
require $pagePath;
|