Fixes error handling and adds changelog
parent
b1c568a2b6
commit
6d4e037d1e
|
@ -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
|
||||||
|
|
||||||
|
---
|
|
@ -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)
|
- 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
|
- 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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class Conference {
|
class Conference {
|
||||||
private $db;
|
private $db;
|
||||||
private $table_name = 'conferences';
|
private $queries;
|
||||||
|
|
||||||
public $jitsi_component;
|
public $jitsi_component;
|
||||||
public $start;
|
public $start;
|
||||||
|
|
|
@ -4,11 +4,17 @@ class Database {
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct($dbFile) {
|
public function __construct($dbFile) {
|
||||||
|
|
||||||
// pdo and pdo_sqlite needed
|
// pdo and pdo_sqlite needed
|
||||||
if ( !extension_loaded('pdo_sqlite') ) {
|
if ( !extension_loaded('pdo_sqlite') ) {
|
||||||
throw new Exception('PDO extension for SQLite not loaded.');
|
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
|
// connect to database
|
||||||
// FIXME: add mysql/mariadb option
|
// FIXME: add mysql/mariadb option
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
* Version: 0.1
|
* 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
|
// list of available pages
|
||||||
// edit accordingly, add 'pages/PAGE.php'
|
// edit accordingly, add 'pages/PAGE.php'
|
||||||
$allowed_urls = [
|
$allowed_urls = [
|
||||||
|
|
|
@ -7,11 +7,18 @@ require 'classes/conference.php';
|
||||||
$from_time = '0000-01-01';
|
$from_time = '0000-01-01';
|
||||||
$until_time = '9999-12-31';
|
$until_time = '9999-12-31';
|
||||||
|
|
||||||
// list of all conferences
|
// connect to database
|
||||||
try {
|
try {
|
||||||
$db = new Database($config['jilo_database']);
|
$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);
|
$search = $conference->conferencesAllFormatted($from_time,$until_time);
|
||||||
|
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
|
@ -27,7 +34,6 @@ try {
|
||||||
'end' => $end,
|
'end' => $end,
|
||||||
'conference_id' => $conference_id,
|
'conference_id' => $conference_id,
|
||||||
'conference_name' => $conference_name,
|
'conference_name' => $conference_name,
|
||||||
// 'participants' => $participants,
|
|
||||||
'participants' => $participants,
|
'participants' => $participants,
|
||||||
'name_count' => $name_count,
|
'name_count' => $name_count,
|
||||||
'conference_host' => $conference_host
|
'conference_host' => $conference_host
|
||||||
|
@ -38,7 +44,9 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} 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";
|
echo "Conferences for the time period $from_time - $until_time";
|
||||||
|
@ -58,7 +66,8 @@ if (!empty($conferences['records'])) {
|
||||||
foreach ($conferences['records'] as $row) {
|
foreach ($conferences['records'] as $row) {
|
||||||
echo "\t\t<tr>";
|
echo "\t\t<tr>";
|
||||||
foreach ($row as $column) {
|
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>";
|
echo "\t\t</tr>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($config as $config_item=>$config_value) { ?>
|
<?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 } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue