Fixes error handling and adds changelog

main
Yasen Pramatarov 2024-07-04 22:14:12 +03:00
parent b1c568a2b6
commit 6d4e037d1e
7 changed files with 61 additions and 7 deletions

26
CHANGELOG.md 100644
View File

@ -0,0 +1,26 @@
# Changelog
All notable changes to this project will be documented in this file.
---
## Unreleased
#### Links
- upstream: https://code.lindeas.com/lindeas/jilo-web
- codeberg: https://codeberg.org/lindeas/jilo-web
- github: https://github.com/lindeas/jilo-web
- gitlab: https://gitlab.com/lindeas/jilo-web
### Added
- Initial version
- Added login and registration
- Added session persistence and cookies
- Added config page with configuration details
- Added conferences page with listing of conferences from the jilo database
### Changed
### Fixed
---

View File

@ -9,3 +9,11 @@ This is still not operational. Goals for v.0.1 - browsing of basic info about Ji
- php support in the web server (deb: php-fpm | libapache2-mod-php)
- pdo and pdo_sqlite support in php (deb: php-db, php-sqlite3) uncomment in php.ini: ;extension=pdo_sqlite
## config
- edit jilo-web.conf.php and set all the variables correctly
- "database" is the sqlite db file for jilo-web itself, create it with `cat jilo-web.schema | sqlite3 jilo-web.db`
- "jilo_database" is the sqlite db file for jilo, with data from the Jitsi logs

View File

@ -2,7 +2,7 @@
class Conference {
private $db;
private $table_name = 'conferences';
private $queries;
public $jitsi_component;
public $start;

View File

@ -4,11 +4,17 @@ class Database {
private $pdo;
public function __construct($dbFile) {
// pdo and pdo_sqlite needed
if ( !extension_loaded('pdo_sqlite') ) {
throw new Exception('PDO extension for SQLite not loaded.');
}
// database file check
if (empty($dbFile) || !file_exists($dbFile)) {
throw new Exception('Database file is not found.');
}
// connect to database
// FIXME: add mysql/mariadb option
try {

View File

@ -11,6 +11,11 @@
* Version: 0.1
*/
// error reporting, comment out in production
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// list of available pages
// edit accordingly, add 'pages/PAGE.php'
$allowed_urls = [

View File

@ -7,11 +7,18 @@ require 'classes/conference.php';
$from_time = '0000-01-01';
$until_time = '9999-12-31';
// list of all conferences
// connect to database
try {
$db = new Database($config['jilo_database']);
$conference = new Conference($db);
} catch (Exception $e) {
$error = 'Error: ' . $e->getMessage();
include 'templates/message.php';
exit();
}
// list of all conferences
try {
$conference = new Conference($db);
$search = $conference->conferencesAllFormatted($from_time,$until_time);
if (!empty($search)) {
@ -27,7 +34,6 @@ try {
'end' => $end,
'conference_id' => $conference_id,
'conference_name' => $conference_name,
// 'participants' => $participants,
'participants' => $participants,
'name_count' => $name_count,
'conference_host' => $conference_host
@ -38,7 +44,9 @@ try {
}
} catch (Exception $e) {
$error = $e->getMessage();
$error = 'Error: ' . $e->getMessage();
include 'templates/message.php';
exit();
}
echo "Conferences for the time period $from_time - $until_time";
@ -58,7 +66,8 @@ if (!empty($conferences['records'])) {
foreach ($conferences['records'] as $row) {
echo "\t\t<tr>";
foreach ($row as $column) {
echo "\t\t\t<td>" . htmlspecialchars($column) . "</td>";
// sometimes $column is empty, we make it '' then
echo "\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>";
}
echo "\t\t</tr>";
}

View File

@ -6,7 +6,7 @@
<ul>
<?php foreach ($config as $config_item=>$config_value) { ?>
<li><?php echo htmlspecialchars($config_item) . ': ' . htmlspecialchars($config_value); ?></li>
<li><?php echo htmlspecialchars($config_item) . ': ' . htmlspecialchars($config_value ?? ''); ?></li>
<?php } ?>
</ul>