Skip to content

Commit

Permalink
Add check to see if User agent is for TSB and update sentry/sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
devang1281 committed Jun 20, 2023
1 parent 9bf768e commit 0427e4d
Show file tree
Hide file tree
Showing 3 changed files with 580 additions and 731 deletions.
14 changes: 8 additions & 6 deletions classes/local/injector.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ public static function inject() {
if (strpos ($quiz->name, ('TSB')) !== FALSE) { // add check for broswer-agent
print $PAGE->url;
echo $_SERVER ['HTTP_USER_AGENT'];
$tsbURL = "tsb://".explode("://",$PAGE->url)[1];
if (!headers_sent()) {
header('Location: '.$tsbURL);
} else {
echo ("<script>location.href='$tsbURL'</script>");
if ($_SERVER ['HTTP_USER_AGENT'] != "Proview-SB") {
$tsbURL = "tsb://".explode("://",$PAGE->url)[1];
if (!headers_sent()) {
header('Location: '.$tsbURL);
} else {
echo ("<script>location.href='$tsbURL'</script>");
}
die;
}
die;
}
}
// Logic for enabling Talview Safe Exam Browser if proctoring is enabled and quiz title contains TSB keyword ENDS
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"description":"Plugin to enable Talview's Proview proctoring solution on Moodle.",
"require": {
"composer/installers": "~1.0",
"sentry/sdk": "^2.1"
"sentry/sdk": "^3.5"
},
"extra": {
"installer-name": "proview"
},
"config": {
"allow-plugins": {
"composer/installers": true,
"php-http/discovery": true
}
}
}
Loading

0 comments on commit 0427e4d

Please sign in to comment.