diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..434bab6 --- /dev/null +++ b/CHANGELOG.md @@ -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 + +--- diff --git a/README.md b/README.md index d30f97b..7b1a861 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/public_html/classes/conference.php b/public_html/classes/conference.php index e879933..a945533 100644 --- a/public_html/classes/conference.php +++ b/public_html/classes/conference.php @@ -2,7 +2,7 @@ class Conference { private $db; - private $table_name = 'conferences'; + private $queries; public $jitsi_component; public $start; diff --git a/public_html/classes/database.php b/public_html/classes/database.php index 08bfb38..57a0c57 100644 --- a/public_html/classes/database.php +++ b/public_html/classes/database.php @@ -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 { diff --git a/public_html/index.php b/public_html/index.php index b04a1a6..ce1c7ec 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -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 = [ diff --git a/public_html/pages/conferences.php b/public_html/pages/conferences.php index 9ad0545..14baec4 100644 --- a/public_html/pages/conferences.php +++ b/public_html/pages/conferences.php @@ -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"; foreach ($row as $column) { - echo "\t\t\t" . htmlspecialchars($column) . ""; + // sometimes $column is empty, we make it '' then + echo "\t\t\t" . htmlspecialchars($column ?? '') . ""; } echo "\t\t"; } diff --git a/public_html/pages/config.php b/public_html/pages/config.php index 418fbc1..f78b4d2 100644 --- a/public_html/pages/config.php +++ b/public_html/pages/config.php @@ -6,7 +6,7 @@