<?php

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

$others_config = scandir(__DIR__);
$loaded = false;
foreach ($others_config as $file) {
	if ($file == basename(__FILE__)) continue;
	if (substr($file, -4) == '.php') {
		require_once __DIR__ . '/' . $file;
		$loaded = true;
	}
}

if (!$loaded) {
	class Configuration
	{
		public const DB_TYPE = 'sqlite';
		// MySQL
		public const DB_HOST = 'localhost';
		public const DB_USER = 'tpsoft_bugreport';
		public const DB_PASS = '****************';
		public const DB_NAME = 'tpsoft_bugreport';
		// SQLite
		public const DB_FILEPATH = __DIR__ . '/../../data/database.db';
	}
}

$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/');
