diff --git a/public_html/helpers/database.php b/public_html/helpers/database.php
index 8122fe2..2561319 100644
--- a/public_html/helpers/database.php
+++ b/public_html/helpers/database.php
@@ -1,43 +1,61 @@
$config['db_type'],
- 'dbFile' => $config['sqlite_file'],
+ 'type' => 'sqlite',
+ 'dbFile' => $config['jilo_database'],
]);
- $pdo = $db->getConnection();
} catch (Exception $e) {
$error = 'Error: ' . $e->getMessage();
include 'templates/block-message.php';
exit();
}
- // mysql/mariadb database
- } elseif ($config['db_type'] === 'mysql' || $config['db_type'] === 'mariadb') {
- try {
- $db = new Database([
- 'type' => $config['db_type'],
- 'host' => $config['sql_host'] ?? 'localhost',
- 'port' => $config['sql_port'] ?? '3306',
- 'dbname' => $config['sql_database'],
- 'user' => $config['sql_username'],
- 'password' => $config['sql_password'],
- ]);
- $pdo = $db->getConnection();
- } catch (Exception $e) {
- $error = 'Error: ' . $e->getMessage();
- include 'templates/block-message.php';
- exit();
- }
- // unknown database
+
} else {
- $error = "Error: unknow database type \"{$config['db_type']}\"";
- include 'templates/block-message.php';
- exit();
+
+ // sqlite database file
+ if ($config['db_type'] === 'sqlite') {
+ try {
+ $db = new Database([
+ 'type' => $config['db_type'],
+ 'dbFile' => $config['sqlite_file'],
+ ]);
+ $pdo = $db->getConnection();
+ } catch (Exception $e) {
+ $error = 'Error: ' . $e->getMessage();
+ include 'templates/block-message.php';
+ exit();
+ }
+ // mysql/mariadb database
+ } elseif ($config['db_type'] === 'mysql' || $config['db_type'] === 'mariadb') {
+ try {
+ $db = new Database([
+ 'type' => $config['db_type'],
+ 'host' => $config['sql_host'] ?? 'localhost',
+ 'port' => $config['sql_port'] ?? '3306',
+ 'dbname' => $config['sql_database'],
+ 'user' => $config['sql_username'],
+ 'password' => $config['sql_password'],
+ ]);
+ $pdo = $db->getConnection();
+ } catch (Exception $e) {
+ $error = 'Error: ' . $e->getMessage();
+ include 'templates/block-message.php';
+ exit();
+ }
+ // unknown database
+ } else {
+ $error = "Error: unknow database type \"{$config['db_type']}\"";
+ include 'templates/block-message.php';
+ exit();
+ }
+
}
+
return $db;
}
?>
diff --git a/public_html/pages/components.php b/public_html/pages/components.php
index f6a1a13..bce8a2e 100644
--- a/public_html/pages/components.php
+++ b/public_html/pages/components.php
@@ -5,7 +5,7 @@ require 'classes/component.php';
// connect to database
require 'helpers/database.php';
-$db = connectDB($config);
+$db = connectDB($config, 'jilo');
// FIXME move thi sto a special function
$time_range_specified = false;
diff --git a/public_html/pages/conferences.php b/public_html/pages/conferences.php
index 83e7c56..037e962 100644
--- a/public_html/pages/conferences.php
+++ b/public_html/pages/conferences.php
@@ -5,7 +5,7 @@ require 'classes/conference.php';
// connect to database
require 'helpers/database.php';
-$db = connectDB($config);
+$db = connectDB($config, 'jilo');
// FIXME move thi sto a special function
$time_range_specified = false;
diff --git a/public_html/pages/front.php b/public_html/pages/front.php
index d76b3bc..d4a0652 100644
--- a/public_html/pages/front.php
+++ b/public_html/pages/front.php
@@ -6,7 +6,7 @@ require 'classes/participant.php';
// connect to database
require 'helpers/database.php';
-$db = connectDB($config);
+$db = connectDB($config, 'jilo');
//
diff --git a/public_html/pages/participants.php b/public_html/pages/participants.php
index 255b46d..15aba56 100644
--- a/public_html/pages/participants.php
+++ b/public_html/pages/participants.php
@@ -5,7 +5,7 @@ require 'classes/participant.php';
// connect to database
require 'helpers/database.php';
-$db = connectDB($config);
+$db = connectDB($config, 'jilo');
// FIXME move thi sto a special function
$time_range_specified = false;