Add roadmap management feature with database schema and user management

- Implemented roadmap.php for displaying and managing roadmap items with filters for quarter and status.
- Created schema.sql to define the database structure for users, invites, daily plans, tasks, brainstorm sessions, brainstorm cards, roadmap items, and integrations.
- Developed users.php for admin panel to manage team members and invitations, including functionality to create and revoke invites.
This commit is contained in:
2026-09-08 12:47:11 +02:00
commit 9da056b480
25 changed files with 3737 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* Fociz Applicatie- en Databaseconfiguratie
*/
// Automatisch eenvoudige .env ondersteuning indien aanwezig
$envFile = __DIR__ . '/../.env';
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
if (str_starts_with(trim($line), '#')) continue;
if (strpos($line, '=') !== false) {
list($name, $value) = explode('=', $line, 2);
$name = trim($name);
$value = trim($value, " \t\n\r\0\x0B\"'");
if (!array_key_exists($name, $_SERVER) && !array_key_exists($name, $_ENV)) {
putenv(sprintf('%s=%s', $name, $value));
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
}
}
}
// MariaDB Verbindingsgegevens (pas deze aan naar uw server instellingen of gebruik .env)
define('DB_HOST', getenv('DB_HOST') ?: '127.0.0.1');
define('DB_PORT', getenv('DB_PORT') ?: '3306');
define('DB_NAME', getenv('DB_NAME') ?: 'fociz');
define('DB_USER', getenv('DB_USER') ?: 'root');
define('DB_PASS', getenv('DB_PASS') !== false ? getenv('DB_PASS') : '');
define('DB_CHARSET', 'utf8mb4');
// Applicatie instellingen
define('APP_NAME', 'Fociz');
define('APP_URL', getenv('APP_URL') ?: ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://') . ($_SERVER['HTTP_HOST'] ?? 'localhost')));
define('APP_SECRET', getenv('APP_SECRET') ?: 'fociz-maria-db-super-secret-key-998877');
// Tijdzone
date_default_timezone_set('Europe/Amsterdam');
+68
View File
@@ -0,0 +1,68 @@
<?php
/**
* MariaDB PDO Databaseverbinding & Automatische Migratie
*/
require_once __DIR__ . '/config.php';
function get_db_connection(): PDO {
static $pdo = null;
if ($pdo === null) {
$dsn = sprintf(
'mysql:host=%s;port=%s;dbname=%s;charset=%s',
DB_HOST,
DB_PORT,
DB_NAME,
DB_CHARSET
);
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
$pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
// Zorg ervoor dat tabellen bestaan
ensure_tables_exist($pdo);
} catch (PDOException $e) {
// Als de database zelf nog niet bestaat, probeer deze aan te maken indien gebruiker rechten heeft
if ($e->getCode() == 1049) {
try {
$tempDsn = sprintf('mysql:host=%s;port=%s;charset=%s', DB_HOST, DB_PORT, DB_CHARSET);
$tempPdo = new PDO($tempDsn, DB_USER, DB_PASS, $options);
$tempPdo->exec(sprintf('CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci', DB_NAME));
$pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
ensure_tables_exist($pdo);
return $pdo;
} catch (PDOException $ex) {
die("Database verbindingsfout: Kan database '" . htmlspecialchars(DB_NAME) . "' niet aanmaken of vinden. Maak deze handmatig aan in MariaDB.");
}
}
die("MariaDB Verbindingsfout: " . htmlspecialchars($e->getMessage()) . "<br><small>Controleer uw instellingen in config/config.php of .env</small>");
}
}
return $pdo;
}
/**
* Zorgt ervoor dat alle tabellen uit schema.sql aanwezig zijn in MariaDB
*/
function ensure_tables_exist(PDO $pdo): void {
try {
$result = $pdo->query("SHOW TABLES LIKE 'users'");
if ($result->rowCount() === 0) {
$schemaFile = __DIR__ . '/../schema.sql';
if (file_exists($schemaFile)) {
$sql = file_get_contents($schemaFile);
$pdo->exec($sql);
}
}
} catch (PDOException $e) {
// Tabellen bestaan waarschijnlijk al of er is een permissiebeperking
}
}