wishthis/index.php
Jay a34cf3ca38 Squashed commit of the following:
commit 52bbe64d73
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Mon Nov 15 12:32:44 2021 +0100

    Add login

commit dce62230b5
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Mon Nov 15 12:20:55 2021 +0100

    Improve installer detection

commit 7d5f19c3b8
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Mon Nov 15 09:45:36 2021 +0100

    Improve installation

commit 39b2ef2c03
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Mon Nov 15 08:28:08 2021 +0100

    Update .gitattributes

commit 364dd117d4
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Mon Nov 15 08:27:09 2021 +0100

    Update .gitattributes

commit e76392487d
Author: grandeljay <github.jay@grandel.anonaddy.me>
Date:   Sun Nov 14 09:13:09 2021 +0100

    Center main content

commit 511de407b0
Author: grandeljay <github.jay@grandel.anonaddy.me>
Date:   Sun Nov 14 09:13:01 2021 +0100

    Connect to database

commit 44c1d26d89
Author: grandeljay <github.jay@grandel.anonaddy.me>
Date:   Sun Nov 14 09:12:49 2021 +0100

    Improve installer

commit 38ace568a1
Author: Jay <github.hybridsupply@grandel.anonaddy.me>
Date:   Fri Nov 12 17:01:04 2021 +0100

    Write config
2021-11-15 12:33:38 +01:00

69 lines
1 KiB
PHP

<?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');
/**
* Config
*/
$configPath = 'includes/config/config.php';
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
);
}
/**
* Install
*/
if ($database) {
try {
$database->getOption('isInstalled');
} catch (\Throwable $th) {
$page = 'install';
}
}
/**
* Session
*/
session_start();
/**
* Page
*/
if (!isset($page)) {
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
}
$pagePath = 'includes/pages/' . $page . '.php';
require $pagePath;