diff --git a/app/helpers/pagination.php b/app/helpers/pagination.php index 9a36352..601a124 100644 --- a/app/helpers/pagination.php +++ b/app/helpers/pagination.php @@ -16,10 +16,10 @@ $param .= '&event=' . $_REQUEST['event']; } if (isset($_REQUEST['from_time'])) { - $param .= '&from_time=' . $_REQUEST['from_time']; + $param .= '&from_time=' . $from_time; } if (isset($_REQUEST['until_time'])) { - $param .= '&until_time=' . $_REQUEST['until_time']; + $param .= '&until_time=' . $until_time; } $max_visible_pages = 10; diff --git a/app/helpers/sanitize.php b/app/helpers/sanitize.php new file mode 100644 index 0000000..4ed6b19 --- /dev/null +++ b/app/helpers/sanitize.php @@ -0,0 +1,29 @@ + diff --git a/app/helpers/time_range.php b/app/helpers/time_range.php index 15f2924..e025244 100644 --- a/app/helpers/time_range.php +++ b/app/helpers/time_range.php @@ -1,16 +1,14 @@ $_POST['type'], - 'url' => $_POST['url'], - 'secret_key' => $_POST['secret_key'], + 'type_id' => $type, + 'url' => $url, + 'secret_key' => $secret_key, ]; $result = $agentObject->addAgent($platform_id, $newAgent); if ($result === true) { @@ -34,7 +40,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // new platform adding } elseif (isset($_POST['new']) && $_POST['new'] === 'true') { $newPlatform = [ - 'name' => $_POST['name'], + 'name' => $name, 'jitsi_url' => $_POST['jitsi_url'], 'jilo_database' => $_POST['jilo_database'], ]; @@ -58,9 +64,9 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { } elseif (isset($_POST['agent'])) { $updatedAgent = [ 'id' => $agent, - 'agent_type_id' => $_POST['type'], - 'url' => $_POST['url'], - 'secret_key' => $_POST['secret_key'], + 'agent_type_id' => $type, + 'url' => $url, + 'secret_key' => $secret_key, ]; $result = $agentObject->editAgent($platform_id, $updatedAgent); if ($result === true) { @@ -73,7 +79,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else { $platform = $_POST['platform']; $updatedPlatform = [ - 'name' => $_POST['name'], + 'name' => $name, 'jitsi_url' => $_POST['jitsi_url'], 'jilo_database' => $_POST['jilo_database'], ]; diff --git a/app/templates/agent-list.php b/app/templates/agent-list.php index 8cb9797..bba0403 100644 --- a/app/templates/agent-list.php +++ b/app/templates/agent-list.php @@ -1,14 +1,14 @@
-

Jilo Agents on platform ()

+

Jilo Agents on platform ()

- agent id: - agent type: () + agent id: + agent type: ()
- endpoint: + endpoint:
- - - - + + + + - - - - + + + +

-
click a button to display data from the agent.
+
click a button to display data from the agent.
diff --git a/app/templates/block-results-filter.php b/app/templates/block-results-filter.php index 29132c2..5c984b5 100644 --- a/app/templates/block-results-filter.php +++ b/app/templates/block-results-filter.php @@ -3,9 +3,9 @@
- /> + /> - /> + /> /> /> diff --git a/app/templates/config-add-agent.php b/app/templates/config-add-agent.php index 5d263d9..c93e732 100644 --- a/app/templates/config-add-agent.php +++ b/app/templates/config-add-agent.php @@ -1,10 +1,10 @@
-

Add new Jilo Agent to Jitsi platform ""

+

Add new Jilo Agent to Jitsi platform ""

- +
diff --git a/app/templates/config-add-platform.php b/app/templates/config-add-platform.php index 07e073f..b5c0666 100644 --- a/app/templates/config-add-platform.php +++ b/app/templates/config-add-platform.php @@ -4,7 +4,7 @@

Add new Jitsi platform

- +
diff --git a/app/templates/config-delete-agent.php b/app/templates/config-delete-agent.php index 5e4cea1..ad53cca 100644 --- a/app/templates/config-delete-agent.php +++ b/app/templates/config-delete-agent.php @@ -1,30 +1,30 @@
-

Jilo Agent configuration for Jitsi platform ""

+

Jilo Agent configuration for Jitsi platform ""

delete an agent:

- + $value) { // if ($key === 'id') continue; ?>
- +
-
- +
+

- +

Are you sure you want to delete this agent?


- Cancel + Cancel
diff --git a/app/templates/config-delete-platform.php b/app/templates/config-delete-platform.php index d7aeb9d..d115e7d 100644 --- a/app/templates/config-delete-platform.php +++ b/app/templates/config-delete-platform.php @@ -1,30 +1,30 @@
-

Jilo web configuration for Jitsi platform ""

+

Jilo web configuration for Jitsi platform ""

delete a platform:

-
+ $value) { if ($key === 'id') continue; ?>
- +
-
+

- +

Are you sure you want to delete this platform?


- Cancel + Cancel
diff --git a/app/templates/config-edit-agent.php b/app/templates/config-edit-agent.php index ff50596..0f50e8e 100644 --- a/app/templates/config-edit-agent.php +++ b/app/templates/config-edit-agent.php @@ -1,10 +1,10 @@
-

Jilo Agent configuration for Jitsi platform ""

+

Jilo Agent configuration for Jitsi platform ""

edit the agent details:

-
+
@@ -30,7 +30,7 @@ *
- +

URL of the Jilo Agent API (https://example.com:8081)

@@ -41,15 +41,15 @@ *
- +

secret key for generating the access JWT token


- - Cancel + + Cancel
diff --git a/app/templates/config-edit-platform.php b/app/templates/config-edit-platform.php index 1b9f83d..98af5f8 100644 --- a/app/templates/config-edit-platform.php +++ b/app/templates/config-edit-platform.php @@ -1,17 +1,17 @@
-

Jilo web configuration for Jitsi platform ""

+

Jilo web configuration for Jitsi platform ""

edit the platform details:

-
+ $value) { if ($key === 'id') continue; ?>
- + *
@@ -27,8 +27,8 @@ foreach ($platformDetails[0] as $key => $value) {

- - Cancel + + Cancel
diff --git a/app/templates/config-list-configjs.php b/app/templates/config-list-configjs.php index bfd6e8a..f4bd96f 100644 --- a/app/templates/config-list-configjs.php +++ b/app/templates/config-list-configjs.php @@ -1,20 +1,20 @@
-

Configuration of the Jitsi platform

+

Configuration of the Jitsi platform

diff --git a/app/templates/config-list-interfaceconfigjs.php b/app/templates/config-list-interfaceconfigjs.php index d37a23a..cf6a4f7 100644 --- a/app/templates/config-list-interfaceconfigjs.php +++ b/app/templates/config-list-interfaceconfigjs.php @@ -1,20 +1,20 @@
-

Configuration of the Jitsi platform

+

Configuration of the Jitsi platform

diff --git a/app/templates/event-list-components.php b/app/templates/event-list-components.php index 6416189..51d3aa1 100644 --- a/app/templates/event-list-components.php +++ b/app/templates/event-list-components.php @@ -6,9 +6,9 @@
- /> + /> - /> + /> /> /> /> @@ -42,7 +42,7 @@ - + @@ -51,11 +51,11 @@ $column) { ?> - + - + - + diff --git a/app/templates/event-list-conferences.php b/app/templates/event-list-conferences.php index d72c948..f3aa04b 100644 --- a/app/templates/event-list-conferences.php +++ b/app/templates/event-list-conferences.php @@ -6,9 +6,9 @@
- /> + /> - /> + /> /> /> @@ -41,7 +41,7 @@ - + @@ -55,21 +55,21 @@ foreach ($row as $key => $column) { if ($key === 'conference ID' && isset($conferenceId) && $conferenceId === $column) { ?> - + - + - + - + - + - + - + - + diff --git a/app/templates/logs-filter.php b/app/templates/logs-filter.php index 6ccf7c9..7de2cc6 100644 --- a/app/templates/logs-filter.php +++ b/app/templates/logs-filter.php @@ -3,9 +3,9 @@
- /> + /> - /> + /> /> /> diff --git a/app/templates/logs-list.php b/app/templates/logs-list.php index b88ba2c..4456642 100644 --- a/app/templates/logs-list.php +++ b/app/templates/logs-list.php @@ -24,7 +24,7 @@ - + @@ -34,9 +34,9 @@ $column) { if ($key === 'user ID' && isset($user_id) && $user_id === $column) { ?> - + - + diff --git a/app/templates/page-menu.php b/app/templates/page-menu.php index 9470040..6db1344 100644 --- a/app/templates/page-menu.php +++ b/app/templates/page-menu.php @@ -17,7 +17,7 @@ ?>
  • - +
  • diff --git a/app/templates/profile-edit.php b/app/templates/profile-edit.php index 08c1a62..e76e1d2 100644 --- a/app/templates/profile-edit.php +++ b/app/templates/profile-edit.php @@ -98,7 +98,7 @@ } ?>
    /> - +
    diff --git a/app/templates/widget-monthly.php b/app/templates/widget-monthly.php index 624941e..045fb32 100644 --- a/app/templates/widget-monthly.php +++ b/app/templates/widget-monthly.php @@ -27,7 +27,7 @@ - + @@ -36,7 +36,7 @@ conferences - + 0 @@ -45,7 +45,7 @@ participants - + 0 diff --git a/app/templates/widget.php b/app/templates/widget.php index 53051fc..888ab79 100644 --- a/app/templates/widget.php +++ b/app/templates/widget.php @@ -24,7 +24,7 @@ - + @@ -37,31 +37,31 @@ if (isset($row['event']) && $row['event'] === 'pair selected') $participant_ip = true; foreach ($row as $key => $column) { if ($key === 'conference ID' && isset($conferenceId) && $conferenceId === $column) { ?> - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/public_html/index.php b/public_html/index.php index de4037b..9b795a8 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -15,6 +15,9 @@ // flush it later only when there is no redirect ob_start(); +// sanitize all vars that may end up in URLs or forms +require '../app/helpers/sanitize.php'; + require '../app/helpers/errors.php'; // error reporting, comment out in production @@ -65,22 +68,11 @@ if ($config_file) { die('Config file not found'); } -$app_root = $config['folder']; +$app_root = htmlspecialchars($config['folder']); session_name('jilo'); session_start(); -if (isset($_REQUEST['page'])) { - $page = $_REQUEST['page']; -} else { - $page = 'dashboard'; -} -if (isset($_REQUEST['item'])) { - $item = $_REQUEST['item']; -} else { - $item = ''; -} - // check if logged in unset($currentUser); if (isset($_COOKIE['username'])) { @@ -96,14 +88,6 @@ if ( !isset($_COOKIE['username']) && ($page !== 'login' && $page !== 'register') exit(); } -// we use 'notice' for all non-critical messages and 'error' for errors -if (isset($_SESSION['notice'])) { - $notice = $_SESSION['notice']; -} -if (isset($_SESSION['error'])) { - $error = $_SESSION['error']; -} - // connect to db of Jilo Web require '../app/classes/database.php'; require '../app/helpers/database.php'; @@ -121,8 +105,10 @@ $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; +if ($platform_id == '') { + $platform_id = $platformsAll[0]['id']; +} + $platformDetails = $platformObject->getPlatformDetails($platform_id); // init user functions