]> _ Git - cubeextranet.git/commitdiff
wip #2227 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 3 Oct 2018 14:11:23 +0000 (14:11 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 3 Oct 2018 14:11:23 +0000 (14:11 +0000)
inc/ws/Controlleur/class.ws.url.php

index 690c89d22ca49767a2782664335bf51e70414f39..dcef8b5c13fcb58b310e0db2db1ffc2eba3aa502 100644 (file)
@@ -1071,7 +1071,7 @@ html{height:100%}' . "\n";
 
                if (count($e) == 2 || $e[2] <= $time - 10) {
                        $e[2] = $time;
-                       http::redirect(SITE_PATH . 'viewerh/' . implode('_', $e) . '/index.html');
+                       http::redirect(SITE_PATH . 'viewerh/' . implode('_', $e) . '/');
                        exit;
                }
 
@@ -1114,13 +1114,13 @@ html{height:100%}' . "\n";
 
                if (count($e) == 2 || $e[2] <= $time - 10) {
                        $e[2] = $time;
-                       http::redirect(SITE_PATH . 'viewers/' . implode('_', $e) . '/index.html');
+                       http::redirect(SITE_PATH . 'viewers/' . implode('_', $e) . '/');
                        exit;
                }
 
                $book_id = $e[0];
                $hash = $e[1];
-               self::commonHTML5Viewer($book_id, $hash);
+               self::commonHTML5Viewer($book_id, $hash, '', ['<head>' => '<head><script type="text/javascript">var FORCE_SCORM=true;</script>']);
        }
 
 
@@ -1133,13 +1133,12 @@ html{height:100%}' . "\n";
                return TIME;
        }
 
-       public static function commonHTML5Viewer($book_id, $hash, $version = '')
+       public static function commonHTML5Viewer($book_id, $hash, $version = '', $replace = [])
        {
                global $core;
                self::checkDocumentVersionOfBook($book_id);
 
                $dao = new wsDAOBook($core->con);
-
                $dir = '';
 
                $book = $dao->selectById($book_id);
@@ -1158,9 +1157,11 @@ html{height:100%}' . "\n";
                }
 
                self::logReferer($book_id);
-
-               echo file_get_contents(WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html');
-
+               $html = file_get_contents(WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html');
+               foreach ($replace as $from => $to) {
+                       $html = str_replace($from, $to, $html);
+               }
+               echo $html;
                exit;
        }
 
@@ -1168,7 +1169,6 @@ html{height:100%}' . "\n";
        {
                $args = cubePage::getArgs($args);
 
-
                $qs = '';
                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
                        $qs = '?' . $_SERVER['QUERY_STRING'];