diff --git a/main/newscorm/lp_upload.php b/main/newscorm/lp_upload.php index a8bbb07498..4ac23d5c69 100755 --- a/main/newscorm/lp_upload.php +++ b/main/newscorm/lp_upload.php @@ -69,6 +69,7 @@ if (Request::is_post() && $is_error) { $oScorm->parse_manifest($manifest); $fixTemplate = api_get_configuration_value('learnpath_fix_xerte_template'); $proxyPath = api_get_configuration_value('learnpath_proxy_url'); + // Check also setting lp_replace_http_to_https if ($fixTemplate && !empty($proxyPath)) { // Check organisations: if (isset($oScorm->manifest['organizations'])) { @@ -78,15 +79,19 @@ if (Request::is_post() && $is_error) { $templatePath = str_replace('imsmanifest.xml', 'template.xml', $manifest); if (file_exists($templatePath) && is_file($templatePath)) { $templateContent = file_get_contents($templatePath); - $find = array( 'href="www.', 'href="https://', 'href="http://', 'url="www.', 'pdfs/download.php?', + "iframe src='https://", - "iframe src='http://" + "iframe src='http://", + + 'href="http://', + 'href="https://', + ); $replace = array( @@ -95,8 +100,12 @@ if (Request::is_post() && $is_error) { 'target = "_blank" href="'.$proxyPath.'?type=link&src=http://', 'url="http://www.', 'pdfs/download.php&', + "iframe src='".$proxyPath."?type=link&src=https://", "iframe src='".$proxyPath."?type=link&src=http://", + + 'href="'.$proxyPath.'?type=link&src=http://', + 'href="'.$proxyPath.'?type=link&src=https://', ); $templateContent = str_replace($find, $replace, $templateContent); file_put_contents($templatePath, $templateContent); @@ -123,10 +132,12 @@ if (Request::is_post() && $is_error) { if (file_exists($framePath) && is_file($framePath)) { $content = file_get_contents($framePath); $find = array( - '$iFrameHolder.html(iFrameTag);' + '$iFrameHolder.html(iFrameTag);', + '$iFrameHolder.html(pageSrc);' ); $replace = array( - 'iFrameTag = \'Open website. \'; $iFrameHolder.html(iFrameTag); ' + 'iFrameTag = \'Open website. \'; $iFrameHolder.html(iFrameTag); ', + 'var html = $.parseHTML(pageSrc); var data = ""; if (html[0]) { data = html[0].getAttribute("src"); data = \'
Open website. \'; } $iFrameHolder.html(pageSrc+ data);' ); $content = str_replace($find, $replace, $content); file_put_contents($framePath, $content);