Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/maven/fixes/8.1' into maven/rele…
Browse files Browse the repository at this point in the history
…ase/8.1
  • Loading branch information
metaventis-build committed Aug 15, 2023
2 parents 22ea25d + 91f21a8 commit ef33ef4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/php/modules/h5p/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Options FollowSymLinks
RewriteEngine On

# RewriteRule ^.* ../redirect.php?ID=%{REQUEST_URI}&%{QUERY_STRING}
RewriteRule (^.*) ../redirect.php?ID=$1&$2 [PT,B,QSA]
RewriteRule (^.*) ../redirect.php?ID=$1&$2&MODULE=h5p [PT,B,QSA]
2 changes: 1 addition & 1 deletion src/main/php/modules/h5p/mod_h5p.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function onXapi(event) {
data.statement = JSON.stringify(event.data.statement);
//console.log("Sending xApi-Event to Repo");
event.data.statement.object.id = "'.$this -> esObject -> getPath().'";
event.data.statement.object.definition.name = {"en-US": "'.$this->esObject->getTitle().'"};
event.data.statement.object.definition.name = '.json_encode(["en-US" => $this->esObject->getTitle()]).';
const nodeID = "'.$this->esObject->getObjectID().'";
let xhr = new XMLHttpRequest();
xhr.open("POST", "'.Config::get('baseUrl').'/rest/node/v1/nodes/-home-/"+nodeID+"/xapi", true);
Expand Down
23 changes: 15 additions & 8 deletions src/main/php/modules/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,25 @@ function addContentHeaders($src_file){
$l_check = sanitizePath($l_check);

$dest_path = parse_url($l_dest, PHP_URL_PATH);
$dest_path = sanitizePath($CC_RENDER_PATH . DIRECTORY_SEPARATOR . $dest_path);
if(isset($_GET["MODULE"])) {
$dest_path = sanitizePath($MC_DOCROOT . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . $_GET["MODULE"] . DIRECTORY_SEPARATOR . $dest_path);

} else {
$dest_path = sanitizePath($CC_RENDER_PATH . DIRECTORY_SEPARATOR . $dest_path);
}

$dest_path = realpath($dest_path);

if ($dest_path === false ||
strpos($dest_path, $CC_RENDER_PATH) !== 0 ||
(
strlen($_SESSION['esrender']['cache_check']) === 0 ||
strpos($dest_path, $_SESSION['esrender']['cache_check']) === false
) && (
strpos($dest_path, '/h5p/libraries') === false &&
strpos($dest_path, '/h5p/content') === false
(strpos($dest_path, $MC_DOCROOT) !== 0 && isset($_GET["MODULE"])) && (
strpos($dest_path, $CC_RENDER_PATH) !== 0 ||
(
strlen($_SESSION['esrender']['cache_check']) === 0 ||
strpos($dest_path, $_SESSION['esrender']['cache_check']) === false
) && (
strpos($dest_path, '/h5p/libraries') === false &&
strpos($dest_path, '/h5p/content') === false
)
)
) {
header('HTTP/1.0 400 Bad Request');
Expand Down

0 comments on commit ef33ef4

Please sign in to comment.