2021-11-12 15:23:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* index.php
|
|
|
|
*
|
|
|
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
|
|
|
*/
|
|
|
|
|
2022-01-13 15:43:07 +00:00
|
|
|
/**
|
2021-11-12 15:23:48 +00:00
|
|
|
* Include
|
|
|
|
*/
|
2021-11-15 13:21:18 +00:00
|
|
|
require 'vendor/autoload.php';
|
2021-11-12 15:23:48 +00:00
|
|
|
|
2021-12-12 10:22:40 +00:00
|
|
|
$include = new Grandel\IncludeDirectory(__DIR__ . '/includes/classes');
|
|
|
|
$include = new Grandel\IncludeDirectory(__DIR__ . '/includes/functions');
|
2021-11-12 15:23:48 +00:00
|
|
|
|
|
|
|
/**
|
2021-11-15 08:45:36 +00:00
|
|
|
* Config
|
2021-11-12 15:23:48 +00:00
|
|
|
*/
|
2022-01-13 15:43:07 +00:00
|
|
|
$configPath = __DIR__ . '/' . 'includes/config/config.php';
|
2021-11-12 15:23:48 +00:00
|
|
|
|
2021-11-14 08:13:01 +00:00
|
|
|
if (file_exists($configPath)) {
|
|
|
|
require $configPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Database
|
|
|
|
*/
|
2021-11-15 11:20:55 +00:00
|
|
|
$database = false;
|
|
|
|
|
2021-11-14 08:13:01 +00:00
|
|
|
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-15 11:20:55 +00:00
|
|
|
}
|
|
|
|
|
2022-01-14 09:50:48 +00:00
|
|
|
/**
|
|
|
|
* Options
|
|
|
|
*/
|
|
|
|
$options = new wishthis\Options($database);
|
|
|
|
|
2022-01-13 15:43:07 +00:00
|
|
|
/**
|
|
|
|
* Session
|
|
|
|
*/
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* API
|
|
|
|
*/
|
|
|
|
if (isset($api)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-15 11:20:55 +00:00
|
|
|
/**
|
|
|
|
* Install
|
|
|
|
*/
|
2022-01-14 09:53:53 +00:00
|
|
|
if (!$options) {
|
|
|
|
$page = 'install';
|
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 08:45:36 +00:00
|
|
|
require $pagePath;
|