externe ueberwachung v1

This commit is contained in:
ma0048
2025-12-02 13:49:05 +01:00
parent 89ec51bd0a
commit 5c9710f44d
15 changed files with 461 additions and 17 deletions
+35
View File
@@ -0,0 +1,35 @@
(function () {
/*
const params = new URLSearchParams(location.search);
let expectedOrigin = params.get("examus-client-origin");
if (!expectedOrigin)
{
window.top.location.href = 'resetconnection.php';
return;
}
*/
let proctoringOK = false;
window.addEventListener("message", function (e) {
/*if (e.origin !== expectedOrigin) {
return;
}*/
const data = e.data || {};
if (data.proctoringIsActive)
{
proctoringOK = true;
}
});
setTimeout(function () {
if (!proctoringOK)
{
console.warn("Constructor nicht aktiv!")
//window.location.href='resetconnection.php';
}
}, 1000);
})();
+5 -1
View File
@@ -45,7 +45,7 @@ if (!$db = new basis_db())
$PHP_SELF=$_SERVER["PHP_SELF"];
// Start session
session_start();
require_once './session_init.php';
// If language is changed by language select menu, reset language variables
if (isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
@@ -182,6 +182,10 @@ echo '
if(!isset($_SESSION['pruefling_id']))
die($p->t('testtool/bitteZuerstAnmelden'));
if (!empty($_SESSION['externe_ueberwachung']) && isset($_SESSION['externe_ueberwachung_verified'])): ?>
<script type="text/javascript" src="externeueberwachung.js"></script>
<?php endif;
$pruefling = new pruefling();
$pruefling->load($_SESSION['pruefling_id']);
+63
View File
@@ -1,16 +1,78 @@
<?php
$contentpage = 'login.php';
require_once './session_init.php';
if(isset($_GET['prestudent']) && is_numeric($_GET['prestudent']))
{
$contentpage = 'login.php?prestudent='.$_GET['prestudent'];
}
if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) &&
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === false)
{
header("Location: resetconnection.php");
exit;
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>TestTool - FH Technikum Wien</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css">
<?php
if (!empty($_SESSION['externe_ueberwachung'])) : ?>
<script>
function loadInContent(url)
{
if (url.includes('logout=true'))
{
return doLogout(url);
}
let frame = document.getElementById('content_testtool');
if (frame)
{
frame.src = url;
}
}
function doLogout(url)
{
fetch(url)
let topbarFrame = window.frames['topbar'];
let menuFrame = window.frames['menu'];
let contentFrame = window.frames['content'];
if (contentFrame)
contentFrame.location.href = 'logout.html';
if (menuFrame)
menuFrame.location.href = menuFrame.location.pathname;
if (topbarFrame)
topbarFrame.location.href = topbarFrame.location.pathname;
return false;
}
function changeSprache(content_params, sprache)
{
let topbarFrame = window.frames['topbar'];
let menuFrame = window.frames['menu'];
let contentFrame = window.frames['content'];
if (topbarFrame)
topbarFrame.location.href = topbarFrame.location.pathname + '?sprache_user=' + sprache;
if (menuFrame)
menuFrame.location.href = menuFrame.location.pathname + '?sprache_user=' + sprache;
if (contentFrame)
contentFrame.location.href = contentFrame.location.pathname + '?' + content_params;
}
</script>
<?php endif; ?>
</head>
<frameset rows="13%,*" cols="*" frameborder="NO" border="0" framespacing="0">
@@ -26,3 +88,4 @@ if(isset($_GET['prestudent']) && is_numeric($_GET['prestudent']))
</noframes>
</frameset>
</html>
+16 -3
View File
@@ -40,8 +40,7 @@ if (!$db = new basis_db())
die('Fehler beim Oeffnen der Datenbankverbindung');
// Start session
session_start();
require_once './session_init.php';
// Logout (triggered by logout button in menu.php)
if (isset($_GET['logout']) && $_GET['logout'] == true)
{
@@ -173,6 +172,12 @@ if (isset($_REQUEST['prestudent']))
else
$reload_menu = true;
}
if ($rt->externe_ueberwachung)
{
$_SESSION['externe_ueberwachung'] = true;
$_SESSION['externe_ueberwachung_verified'] = false;
}
}
$pruefling = new pruefling();
@@ -339,6 +344,8 @@ if ((isset($_SESSION['prestudent_id']) && !isset($_SESSION['pruefling_id']) &&
!isset($_SESSION['confirmation_needed']) && !isset($_SESSION['confirmed_code'])) ||
(isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === true &&
isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true &&
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === true &&
isset($_SESSION['prestudent_id']) && !isset($_SESSION['pruefling_id'])))
{
$pruefling = new pruefling();
@@ -468,7 +475,13 @@ if (isset($_POST['save']) && isset($_SESSION['prestudent_id']))
<?php
if (isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) &&
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === false)
{
echo "<script> top.location.href = 'resetconnection.php';</script>";
exit;
}
else if (isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === false)
{
echo '
+25 -5
View File
@@ -34,7 +34,7 @@ if (!$db = new basis_db())
die('Fehler beim Oeffnen der Datenbankverbindung');
// Start session
session_start();
require_once './session_init.php';
// If language is changed by language select menu, reset language and session variables
if(isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
@@ -73,7 +73,7 @@ if (isset($_SESSION['pruefling_id']))
// Link zur Startseite
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
<a class="ItemTesttool navButton" href="login.php" target="content">'.$p->t('testtool/startseite').'</a>
<a class="ItemTesttool navButton" href="login.php" onclick="return loadContent(this.href);">'.$p->t('testtool/startseite').'</a>
</td></tr>';
// Link zur Einleitung
@@ -83,7 +83,7 @@ if (isset($_SESSION['pruefling_id']))
{
echo '
<tr id="tr-einleitung"><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
<a class="ItemTesttool navButton" href="../../cms/content.php?content_id='.$content_id->content_id.'&sprache='.$sprache_user.'" target="content">'.$p->t('testtool/einleitung').'</a>
<a class="ItemTesttool navButton" href="../../cms/content.php?content_id='.$content_id->content_id.'&sprache='.$sprache_user.'" onclick="return loadContent(this.href);">'.$p->t('testtool/einleitung').'</a>
</td></tr>
';
}
@@ -379,10 +379,13 @@ if (isset($_SESSION['pruefling_id']))
}
}
echo '<tr>
<!--<td width="10" class="ItemTesttoolLeft" nowrap>&nbsp;</td>-->
<td class="'.$class.'">
<a class="'.$class.'" href="frage.php?gebiet_id='.$row->gebiet_id.'" onclick="document.location.reload()" target="content" style="'.$style.'">'.$gebietbezeichnung.'</a>
<a class="'.$class.'" href="frage.php?gebiet_id='.$row->gebiet_id.'" onclick="return loadContent(this.href);" style="'.$style.'">'.$gebietbezeichnung.'</a>
</td>
<!--<td width="10" class="ItemTesttoolRight" nowrap>&nbsp;</td>-->
</tr>';
@@ -401,7 +404,7 @@ if (isset($_SESSION['pruefling_id']))
// Link zum Logout
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
<a class="ItemTesttool navButton" href="login.php?logout=true" target="content">Logout</a>
<a class="ItemTesttool navButton" href="login.php?logout=true" onclick="return loadContent(this.href);">Logout</a>
</td></tr>';
echo '</td></tr></table>';
@@ -461,5 +464,22 @@ else
'</td></tr>');
}
});
function loadContent(url)
{
if (parent && typeof parent.loadInContent === 'function')
{
parent.loadInContent(url);
return false;
}
let frame = parent?.frames?.["content"];
if (frame)
{
frame.location.href = url;
return false;
}
}
</script>
</html>
+25
View File
@@ -0,0 +1,25 @@
<?php
require_once './session_init.php';
require_once('../../config/cis.config.inc.php');
require_once('../../config/global.config.inc.php');
require_once '../../include/externe_ueberwachung.class.php';
if (!$db = new basis_db())
die('Fehler beim Oeffnen der Datenbankverbindung');
if (isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true)
{
$ueberwachung = new externeUeberwachung();
$url = $ueberwachung->start($_SESSION['prestudent_id'], $_SESSION['reihungstestID']);
$urlSafe = htmlspecialchars($url, ENT_QUOTES);
//var_dump($urlSafe);
header("Location: $urlSafe");
//echo "<script>window.open('{$urlSafe}');</script>";
$_SESSION['externe_ueberwachung_verified'] = true;
}
+11
View File
@@ -0,0 +1,11 @@
<?php
if (session_status() === PHP_SESSION_NONE) {
session_set_cookie_params(
0,
'/; samesite=None',
'',
true,
true
);
session_start();
}
+11 -3
View File
@@ -67,9 +67,17 @@ function changeSprache(sprache)
content_params.set('sprache_user', sprache); // add or replace sprache_user
// Pass GET-param sprache_user to topbar.php, menu.php and content (login.php or frage.php) and refresh the frames.
location.href = location.pathname + '?sprache_user=' + sprache; // refreshes topbar.php
parent.menu.location.href = parent.menu.location.pathname + '?sprache_user=' + sprache; // refreshes menu.php
parent.content.location.href = parent.content.location.pathname + '?' + content_params; // refreshes login.php or frage.php
if (parent && typeof parent.changeSprache === 'function')
{
parent.changeSprache(content_params, sprache);
return false;
}
else
{
location.href = location.pathname + '?sprache_user=' + sprache; // refreshes topbar.php
parent.menu.location.href = parent.menu.location.pathname + '?sprache_user=' + sprache; // refreshes menu.php
parent.content.location.href = parent.content.location.pathname + '?' + content_params; // refreshes login.php or frage.php
}
}
$(document).on("keydown", function (e) {