Compare commits
No commits in common. "dc9462260d78f62a25a361eebed7cb1df4b7a02a" and "7d85c9181d1773a69bef30f4754591e74be9049d" have entirely different histories.
dc9462260d
...
7d85c9181d
|
@ -6,9 +6,6 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
- Jitsi platforms config moved from file to SQLite database
|
||||
|
||||
#### Links
|
||||
- upstream: https://code.lindeas.com/lindeas/jilo-web/compare/v0.2...HEAD
|
||||
- codeberg: https://codeberg.org/lindeas/jilo-web/compare/v0.2...HEAD
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
|
||||
class Config {
|
||||
|
||||
public function getPlatformDetails($config, $platform_id) {
|
||||
$platformDetails = $config['platforms'][$platform_id];
|
||||
return $platformDetails;
|
||||
}
|
||||
|
||||
// loading the config.js
|
||||
public function getPlatformConfigjs($jitsiUrl, $raw = false) {
|
||||
public function getPlatformConfigjs($platformDetails, $raw = false) {
|
||||
// constructing the URL
|
||||
$configjsFile = $jitsiUrl . '/config.js';
|
||||
$configjsFile = $platformDetails['jitsi_url'] . '/config.js';
|
||||
|
||||
// default content, if we can't get the file contents
|
||||
$platformConfigjs = "The file $configjsFile can't be loaded.";
|
||||
|
@ -45,9 +50,9 @@ class Config {
|
|||
|
||||
|
||||
// loading the interface_config.js
|
||||
public function getPlatformInterfaceConfigjs($jitsiUrl, $raw = false) {
|
||||
public function getPlatformInterfaceConfigjs($platformDetails, $raw = false) {
|
||||
// constructing the URL
|
||||
$interfaceConfigjsFile = $jitsiUrl . '/interface_config.js';
|
||||
$interfaceConfigjsFile = $platformDetails['jitsi_url'] . '/interface_config.js';
|
||||
|
||||
// default content, if we can't get the file contents
|
||||
$platformInterfaceConfigjs = "The file $interfaceConfigjsFile can't be loaded.";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require '../app/helpers/errors.php';
|
||||
|
||||
class Database {
|
||||
private $pdo;
|
||||
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Platform {
|
||||
private $db;
|
||||
|
||||
public function __construct($database) {
|
||||
$this->db = $database->getConnection();
|
||||
}
|
||||
|
||||
// get details of a specified platform ID (or all)
|
||||
public function getPlatformDetails($platform_id = '') {
|
||||
$sql = 'SELECT * FROM platforms';
|
||||
if ($platform_id !== '') {
|
||||
$sql .= ' WHERE id = :platform_id';
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->bindParam(':platform_id', $platform_id);
|
||||
} else {
|
||||
$query = $this->db->prepare($sql);
|
||||
}
|
||||
|
||||
$query->execute();
|
||||
|
||||
return $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// add new platform
|
||||
public function addPlatform($newPlatform) {
|
||||
try {
|
||||
$sql = 'INSERT INTO platforms
|
||||
(name, jitsi_url, jilo_database)
|
||||
VALUES
|
||||
(:name, :jitsi_url, :jilo_database)';
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->execute([
|
||||
':name' => $newPlatform['name'],
|
||||
':jitsi_url' => $newPlatform['jitsi_url'],
|
||||
':jilo_database' => $newPlatform['jilo_database'],
|
||||
]);
|
||||
|
||||
$query->execute();
|
||||
return true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// edit an existing platform
|
||||
public function editPlatform($platform_id, $updatedPlatform) {
|
||||
try {
|
||||
$sql = 'UPDATE platforms SET
|
||||
name = :name,
|
||||
jitsi_url = :jitsi_url,
|
||||
jilo_database = :jilo_database
|
||||
WHERE
|
||||
id = :platform_id';
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->execute([
|
||||
':name' => $updatedPlatform['name'],
|
||||
':jitsi_url' => $updatedPlatform['jitsi_url'],
|
||||
':jilo_database' => $updatedPlatform['jilo_database'],
|
||||
':platform_id' => $platform_id,
|
||||
]);
|
||||
|
||||
$query->execute();
|
||||
return true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// delete a platform
|
||||
public function deletePlatform($platform_id) {
|
||||
try {
|
||||
$sql = 'DELETE FROM platforms
|
||||
WHERE
|
||||
id = :platform_id';
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->bindParam(':platform_id', $platform_id);
|
||||
|
||||
$query->execute();
|
||||
return true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -31,6 +31,27 @@ return [
|
|||
// development has verbose error messages, production has not
|
||||
'environment' => 'development',
|
||||
|
||||
// *************************************
|
||||
// Maintained by the app, edit with care
|
||||
// *************************************
|
||||
|
||||
'platforms' => [
|
||||
'0' => [
|
||||
'name' => 'lindeas',
|
||||
'jitsi_url' => 'https://meet.lindeas.com',
|
||||
'jilo_database' => '../../jilo/jilo-meet.lindeas.db',
|
||||
],
|
||||
'1' => [
|
||||
'name' => 'meet.example.com',
|
||||
'jitsi_url' => 'https://meet.example.com',
|
||||
'jilo_database' => '../../jilo/jilo.db',
|
||||
],
|
||||
'2' => [
|
||||
'name' => 'test3',
|
||||
'jitsi_url' => 'https://test3.example.com',
|
||||
'jilo_database' => '../../jilo/jilo2.db',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
// Function to format arrays with square brackets
|
||||
function formatArray(array $array, $indentLevel = 2) {
|
||||
$indent = str_repeat(' ', $indentLevel); // 4 spaces per indent level
|
||||
$output = "[\n";
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
$output .= $indent . "'" . $key . "'" . ' => ';
|
||||
|
||||
if (is_array($value)) {
|
||||
$output .= formatArray($value, $indentLevel + 1);
|
||||
} else {
|
||||
$output .= var_export($value, true);
|
||||
}
|
||||
|
||||
$output .= ",\n";
|
||||
}
|
||||
|
||||
$output .= str_repeat(' ', $indentLevel - 1) . ']';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
// connect to database
|
||||
function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
||||
function connectDB($config, $database = '', $platform_id = '') {
|
||||
|
||||
// connecting ti a jilo sqlite database
|
||||
if ($database === 'jilo') {
|
||||
try {
|
||||
$dbFile = $config['platforms'][$platform_id]['jilo_database'] ?? null;
|
||||
if (!$dbFile || !file_exists($dbFile)) {
|
||||
throw new Exception(getError("Invalid platform ID \"{$platformId}\", database file \"{$dbFile}\" not found."));
|
||||
throw new Exception(getError("Invalid platform ID \"{$platform_id}\", database file \"{$dbFile}\"not found."));
|
||||
}
|
||||
$db = new Database([
|
||||
'type' => 'sqlite',
|
||||
|
|
|
@ -4,14 +4,40 @@
|
|||
function renderConfig($configPart, $indent, $platform=false, $parent='') {
|
||||
global $app_root;
|
||||
global $config;
|
||||
if ($parent === 'platforms') {
|
||||
?>
|
||||
<div class="col-md-8 text-start">
|
||||
<a class="btn btn-secondary" style="padding: 0px;" href="<?= $app_root ?>?page=config&action=add">add</a>
|
||||
</div>
|
||||
<div class="border bg-light" style="padding-left: <?= $indent ?>px; padding-bottom: 20px; padding-top: 20px;">
|
||||
<?php } else {
|
||||
?>
|
||||
<div style="padding-left: <?= $indent ?>px; padding-bottom: 20px;">
|
||||
<?php foreach ($configPart as $config_item => $config_value) { ?>
|
||||
<?php
|
||||
}
|
||||
foreach ($configPart as $config_item => $config_value) {
|
||||
if ($parent === 'platforms') {
|
||||
$indent = 0;
|
||||
}
|
||||
?>
|
||||
<div class="row mb-1" style="padding-left: <?= $indent ?>px;">
|
||||
<div class="col-md-4 text-end">
|
||||
<?= htmlspecialchars($config_item) ?>:
|
||||
</div>
|
||||
<?php
|
||||
if ($parent === 'platforms') { ?>
|
||||
<div class="col-md-8 text-start">
|
||||
<a class="btn btn-secondary" style="padding: 2px;" href="<?= $app_root ?>?platform=<?= htmlspecialchars($config_item) ?>&page=config&action=edit">edit</a>
|
||||
<?php
|
||||
// we don't delete the last platform
|
||||
if (count($configPart) <= 1) { ?>
|
||||
<span class="btn btn-light" style="padding: 2px;" href="#" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="can't delete the last platform">delete</span>
|
||||
<?php } else { ?>
|
||||
<a class="btn btn-danger" style="padding: 2px;" href="<?= $app_root ?>?platform=<?= htmlspecialchars($config_item) ?>&page=config&action=delete">delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
if (is_array($config_value)) {
|
||||
// here we render recursively nested arrays
|
||||
$indent = $indent + 50;
|
||||
|
@ -29,11 +55,15 @@ function renderConfig($configPart, $indent, $platform=false, $parent='') {
|
|||
?>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($config_value ?? '')?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?= $platform ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/component.php';
|
||||
|
||||
// connect to database
|
||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config, 'jilo', $platform_id);
|
||||
|
||||
// specify time range
|
||||
include '../app/helpers/time_range.php';
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/conference.php';
|
||||
|
||||
// connect to database
|
||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config, 'jilo', $platform_id);
|
||||
|
||||
// specify time range
|
||||
include '../app/helpers/time_range.php';
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
$action = $_REQUEST['action'] ?? '';
|
||||
require '../app/classes/config.php';
|
||||
require_once '../app/classes/config.php';
|
||||
require '../app/helpers/errors.php';
|
||||
require '../app/helpers/config.php';
|
||||
|
||||
$configure = new Config();
|
||||
|
||||
|
@ -19,26 +21,62 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database'],
|
||||
];
|
||||
$platformObject->addPlatform($newPlatform);
|
||||
|
||||
// Determine the next available index for the new platform
|
||||
$nextIndex = count($config['platforms']);
|
||||
|
||||
// Add the new platform to the platforms array
|
||||
$config['platforms'][$nextIndex] = $newPlatform;
|
||||
|
||||
// Rebuild the PHP array syntax for the platforms
|
||||
$platformsArray = formatArray($config['platforms']);
|
||||
|
||||
// Replace the platforms section in the config file
|
||||
$updatedContent = preg_replace(
|
||||
'/\'platforms\'\s*=>\s*\[[\s\S]+?\],/s',
|
||||
"'platforms' => {$platformsArray}",
|
||||
$content
|
||||
);
|
||||
$updatedContent = preg_replace('/\s*\]\n/s', "\n", $updatedContent);
|
||||
|
||||
// deleting a platform
|
||||
} elseif (isset($_POST['delete']) && $_POST['delete'] === 'true') {
|
||||
$platform = $_POST['platform'];
|
||||
$platformObject->deletePlatform($platform);
|
||||
|
||||
$config['platforms'][$platform]['name'] = $_POST['name'];
|
||||
$config['platforms'][$platform]['jitsi_url'] = $_POST['jitsi_url'];
|
||||
$config['platforms'][$platform]['jilo_database'] = $_POST['jilo_database'];
|
||||
|
||||
$platformsArray = formatArray($config['platforms'][$platform], 3);
|
||||
|
||||
$updatedContent = preg_replace(
|
||||
"/\s*'$platform'\s*=>\s*\[\s*'name'\s*=>\s*'[^']*',\s*'jitsi_url'\s*=>\s*'[^']*,\s*'jilo_database'\s*=>\s*'[^']*',\s*\],/s",
|
||||
"",
|
||||
$content
|
||||
);
|
||||
|
||||
|
||||
// an update to an existing platform
|
||||
} else {
|
||||
|
||||
$platform = $_POST['platform'];
|
||||
$updatedPlatform = [
|
||||
'name' => $_POST['name'],
|
||||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database'],
|
||||
];
|
||||
$platformObject->editPlatform($platform, $updatedPlatform);
|
||||
|
||||
$config['platforms'][$platform]['name'] = $_POST['name'];
|
||||
$config['platforms'][$platform]['jitsi_url'] = $_POST['jitsi_url'];
|
||||
$config['platforms'][$platform]['jilo_database'] = $_POST['jilo_database'];
|
||||
|
||||
$platformsArray = formatArray($config['platforms'][$platform], 3);
|
||||
|
||||
$updatedContent = preg_replace(
|
||||
"/\s*'$platform'\s*=>\s*\[\s*'name'\s*=>\s*'[^']*',\s*'jitsi_url'\s*=>\s*'[^']*',\s*'jilo_database'\s*=>\s*'[^']*',\s*\],/s",
|
||||
"\n '{$platform}' => {$platformsArray},",
|
||||
$content
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// check if file is writable
|
||||
if (!is_writable($config_file)) {
|
||||
$_SESSION['error'] = getError('Configuration file is not writable.');
|
||||
|
@ -69,13 +107,15 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
case 'configjs':
|
||||
$mode = $_REQUEST['mode'] ?? '';
|
||||
$raw = ($mode === 'raw');
|
||||
$platformConfigjs = $configure->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||
$platformDetails = $configure->getPlatformDetails($config, $platform_id);
|
||||
$platformConfigjs = $configure->getPlatformConfigjs($platformDetails, $raw);
|
||||
include('../app/templates/config-list-configjs.php');
|
||||
break;
|
||||
case 'interfaceconfigjs':
|
||||
$mode = $_REQUEST['mode'] ?? '';
|
||||
$raw = ($mode === 'raw');
|
||||
$platformInterfaceConfigjs = $configure->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||
$platformDetails = $configure->getPlatformDetails($config, $platform_id);
|
||||
$platformInterfaceConfigjs = $configure->getPlatformInterfaceConfigjs($platformDetails, $raw);
|
||||
include('../app/templates/config-list-interfaceconfigjs.php');
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/conference.php';
|
||||
require '../app/classes/participant.php';
|
||||
|
||||
// connect to database
|
||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config, 'jilo', $platform_id);
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/user.php';
|
||||
|
||||
// clear the global error var before login
|
||||
|
@ -8,9 +9,10 @@ unset($error);
|
|||
try {
|
||||
|
||||
// connect to database
|
||||
$dbWeb = connectDB($config);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config);
|
||||
|
||||
$user = new User($dbWeb);
|
||||
$user = new User($db);
|
||||
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$username = $_POST['username'];
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/participant.php';
|
||||
|
||||
// connect to database
|
||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config, 'jilo', $platform_id);
|
||||
|
||||
// specify time range
|
||||
include '../app/helpers/time_range.php';
|
||||
|
|
|
@ -3,15 +3,17 @@
|
|||
// registration is allowed, go on
|
||||
if ($config['registration_enabled'] === true) {
|
||||
|
||||
require_once '../app/classes/database.php';
|
||||
require '../app/classes/user.php';
|
||||
unset($error);
|
||||
|
||||
try {
|
||||
|
||||
// connect to database
|
||||
$dbWeb = connectDB($config);
|
||||
require '../app/helpers/database.php';
|
||||
$db = connectDB($config);
|
||||
|
||||
$user = new User($dbWeb);
|
||||
$user = new User($db);
|
||||
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$username = $_POST['username'];
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
|
||||
<!-- widget "config" -->
|
||||
<div class="card text-center w-50 mx-auto">
|
||||
<p class="h4 card-header">Jilo web configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<p class="h4 card-header">Jilo web configuration for Jitsi platform "<?= htmlspecialchars($platform_id) ?>"</p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">delete a platform:</p>
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
<?php
|
||||
foreach ($platformDetails[0] as $key => $value) {
|
||||
if ($key === 'id') continue;
|
||||
?>
|
||||
<?php foreach ($config['platforms'][$platform_id] as $config_item => $config_value) { ?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="<?= htmlspecialchars($key) ?>" class="form-label"><?= htmlspecialchars($key) ?>:</label>
|
||||
<label for="<?= htmlspecialchars($config_item) ?>" class="form-label"><?= htmlspecialchars($config_item) ?>:</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="text-start"><?= htmlspecialchars($value ?? '')?></div>
|
||||
<input type="hidden" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '')?>" />
|
||||
<div class="text-start"><?= htmlspecialchars($config_value ?? '')?></div>
|
||||
<input type="hidden" name="<?= htmlspecialchars($config_item) ?>" value="<?= htmlspecialchars($config_value ?? '')?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
|
||||
<!-- widget "config" -->
|
||||
<div class="card text-center w-50 mx-auto">
|
||||
<p class="h4 card-header">Jilo web configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<p class="h4 card-header">Jilo web configuration for Jitsi platform "<?= htmlspecialchars($platform_id) ?>"</p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">edit the platform details:</p>
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
<?php
|
||||
foreach ($platformDetails[0] as $key => $value) {
|
||||
if ($key === 'id') continue;
|
||||
?>
|
||||
<?php foreach ($config['platforms'][$platform_id] as $config_item => $config_value) { ?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="<?= htmlspecialchars($config_item) ?>" class="form-label"><?= htmlspecialchars($key) ?></label>
|
||||
<label for="<?= htmlspecialchars($config_item) ?>" class="form-label"><?= htmlspecialchars($config_item) ?></label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '')?>" required />
|
||||
<?php if ($key === 'name') { ?>
|
||||
<input class="form-control" type="text" name="<?= htmlspecialchars($config_item) ?>" value="<?= htmlspecialchars($config_value ?? '')?>" required />
|
||||
<?php if ($config_item === 'name') { ?>
|
||||
<p class="text-start"><small>descriptive name for the platform</small></p>
|
||||
<?php } elseif ($key === 'jitsi_url') { ?>
|
||||
<?php } elseif ($config_item === 'jitsi_url') { ?>
|
||||
<p class="text-start"><small>URL of the Jitsi Meet (used for checks and for loading config.js)</small></p>
|
||||
<?php } elseif ($key === 'jilo_database') { ?>
|
||||
<?php } elseif ($config_item === 'jilo_database') { ?>
|
||||
<p class="text-start"><small>path to the database file (relative to the app root)</small></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
<!-- widget "config" -->
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Configuration of the Jitsi platform <strong><?= htmlspecialchars($platformDetails[0]['name']) ?></strong></p>
|
||||
<p class="h4 card-header">Configuration of the Jitsi platform <strong><?= htmlspecialchars($platformDetails['name']) ?></strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
<span class="m-3">URL: <?= htmlspecialchars($platformDetails[0]['jitsi_url']) ?></span>
|
||||
<span class="m-3">URL: <?= htmlspecialchars($platformDetails['jitsi_url']) ?></span>
|
||||
<span class="m-3">FILE: config.js</span>
|
||||
<?php if ($mode === 'raw') { ?>
|
||||
<span class="m-3"><a class="btn btn-light" href="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config&item=configjs">view only active lines</a></span>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
<!-- widget "config" -->
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Configuration of the Jitsi platform <strong><?= htmlspecialchars($platformDetails[0]['name']) ?></strong></p>
|
||||
<p class="h4 card-header">Configuration of the Jitsi platform <strong><?= htmlspecialchars($platformDetails['name']) ?></strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
<span class="m-3">URL: <?= htmlspecialchars($platformDetails[0]['jitsi_url']) ?></span>
|
||||
<span class="m-3">URL: <?= htmlspecialchars($platformDetails['jitsi_url']) ?></span>
|
||||
<span class="m-3">FILE: interface_config.js</span>
|
||||
<?php if ($mode === 'raw') { ?>
|
||||
<span class="m-3"><a class="btn btn-light" href="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config&item=interfaceconfigjs">view only active lines</a></span>
|
||||
|
|
|
@ -3,52 +3,12 @@
|
|||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Jilo web configuration</p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">main variables</p>
|
||||
<p class="card-text">platform variables</p>
|
||||
<?php
|
||||
include '../app/helpers/render.php';
|
||||
renderConfig($config, '0');
|
||||
echo "\n";
|
||||
?>
|
||||
|
||||
<hr />
|
||||
<p class="card-text">platforms configuration <a class="btn btn-secondary" style="padding: 0px;" href="/jilo-web/?page=config&action=add">add</a></p>
|
||||
|
||||
<?php foreach ($platformsAll as $platform_array) { ?>
|
||||
|
||||
<div class="row mb-3" style="padding-left: 0px;">
|
||||
<div class="border bg-light" style="padding-left: 50px; padding-bottom: 20px; padding-top: 20px;">
|
||||
<div class="row mb-1" style="padding-left: 0px;">
|
||||
<div class="col-md-4 text-end">
|
||||
<?= $platform_array['id'] ?>:
|
||||
</div>
|
||||
<div class="col-md-8 text-start">
|
||||
<a class="btn btn-secondary" style="padding: 2px;" href="/jilo-web/?platform=<?= htmlspecialchars($platform_array['id']) ?>&page=config&action=edit">edit</a>
|
||||
<?php if (count($platformsAll) <= 1) { ?>
|
||||
<span class="btn btn-light" style="padding: 2px;" href="#" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="can't delete the last platform">delete</span>
|
||||
<?php } else { ?>
|
||||
<a class="btn btn-danger" style="padding: 2px;" href="/jilo-web/?platform=<?= htmlspecialchars($platform_array['id'])?>&page=config&action=delete">delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div style="padding-left: 100px; padding-bottom: 20px;">
|
||||
<?php foreach ($platform_array as $key => $value) {
|
||||
if ($key === 'id') continue;
|
||||
?>
|
||||
<div class="row mb-1" style="padding-left: 100px;">
|
||||
<div class="col-md-4 text-end">
|
||||
<?= $key ?>:
|
||||
</div>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= $value ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "config" -->
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
<?php if ( isset($_SESSION['username']) ) { ?>
|
||||
|
||||
<?php foreach ($platformsAll as $platform) { ?>
|
||||
<?php foreach ($config['platforms'] as $index => $platform) { ?>
|
||||
<li style="margin-right: 3px;">
|
||||
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars($platform['id']) ?>&page=front">
|
||||
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars($index) ?>&page=front">
|
||||
<?= htmlspecialchars($platform['name']) ?>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -3,21 +3,3 @@ CREATE TABLE users (
|
|||
username TEXT NOT NULL UNIQUE,
|
||||
password TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE platforms (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
jitsi_url TEXT NOT NULL,
|
||||
jilo_database TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE jilo_agents (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
platform_id INTEGER NOT NULL,
|
||||
type_id INTEGER NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
secret_key TEXT
|
||||
);
|
||||
CREATE TABLE jilo_agent_types (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
description TEXT,
|
||||
endponts TEXT
|
||||
);
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
// flush it later only when there is no redirect
|
||||
ob_start();
|
||||
|
||||
require '../app/helpers/errors.php';
|
||||
|
||||
// error reporting, comment out in production
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
|
@ -98,20 +96,8 @@ if (isset($_SESSION['error'])) {
|
|||
$error = $_SESSION['error'];
|
||||
}
|
||||
|
||||
// connect to db of Jilo Web
|
||||
require '../app/classes/database.php';
|
||||
require '../app/helpers/database.php';
|
||||
$dbWeb = connectDB($config);
|
||||
|
||||
// get platforms details
|
||||
require '../app/classes/platform.php';
|
||||
$platformObject = new Platform($dbWeb);
|
||||
$platformsAll = $platformObject->getPlatformDetails();
|
||||
|
||||
// by default we connect ot the first configured platform
|
||||
$firstPlatform = $platformsAll[0]['id'];
|
||||
$platform_id = $_REQUEST['platform'] ?? $firstPlatform;
|
||||
$platformDetails = $platformObject->getPlatformDetails($platform_id);
|
||||
$platform_id = $_REQUEST['platform'] ?? '0';
|
||||
|
||||
// page building
|
||||
if (in_array($page, $allowed_urls)) {
|
||||
|
|
Loading…
Reference in New Issue