<?php

if (file_exists('c:/php/includes/igor.php')) {
	require_once 'c:/php/includes/igor.php';
}

require_once __DIR__.'/lib/functions.inc.php';
require_once __DIR__.'/lib/Medoo/src/Medoo.php';

$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['REQUEST_URI']; // obsahuje aj query string


define('URL_PREFIX', $protocol.$host.str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']));

define('UPLOAD_DIR_ATTACHMENTS', __DIR__.'/data/attachments/');
if (!file_exists(UPLOAD_DIR_ATTACHMENTS)) {
	mkdir(UPLOAD_DIR_ATTACHMENTS, 0777, true);
}
define('UPLOAD_URL_ATTACHMENTS', URL_PREFIX.'data/attachments/');

global $db;
$db = new Medoo\Medoo([
	'type' => 'sqlite',
	'database' => __DIR__ . '/data/database.db'
]);
dbCheck();


?>