From 43e9c7adcb277e010914c5fd9dee4c698bfb8d03 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 27 Jan 2016 12:42:55 +0100 Subject: [PATCH 1/5] Avoid navigating inside iframe HFJ-1479 --- js/h5p.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 06f5ccb..d3e8b2c 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -375,7 +375,8 @@ H5P.getHeadTags = function (contentId) { return tags; }; - return createStyleTags(H5PIntegration.core.styles) + + return '' + + createStyleTags(H5PIntegration.core.styles) + createStyleTags(H5PIntegration.contents['cid-' + contentId].styles) + createScriptTags(H5PIntegration.core.scripts) + createScriptTags(H5PIntegration.contents['cid-' + contentId].scripts) + From 13a29884145ef2e5b8af2822af5faa2d9835d949 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 10 Mar 2016 14:14:00 +0100 Subject: [PATCH 2/5] Revert "HFJ-1610 - Track libraries installed." This reverts commit 5287d455b2f3ad6f4965759b6a9c9fde581dacf0. --- h5p.classes.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index 9627610..b79909e 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2405,28 +2405,6 @@ class H5PCore { } } - /** - * Get a list of installed libraries, different minor versions will - * return separate entries. - * - * @return array - * A distinct array of installed libraries - */ - public function getLibrariesInstalled() { - $librariesInstalled = []; - - $libs = $this->h5pF->loadLibraries(); - - foreach($libs as $library) { - foreach($library as $libVersion) { - - $librariesInstalled[] = $libVersion->name.' '.$libVersion->major_version.'.'.$libVersion->minor_version.'.'.$libVersion->patch_version; - } - } - - return $librariesInstalled; - } - /** * Fetch a list of libraries' metadata from h5p.org. * Save URL tutorial to database. Each platform implementation @@ -2438,7 +2416,6 @@ class H5PCore { $platformInfo['uuid'] = $this->h5pF->getOption('site_uuid', ''); $platformInfo['siteType'] = $this->h5pF->getOption('site_type', 'local'); $platformInfo['libraryContentCount'] = $this->h5pF->getLibraryContentCount(); - $platformInfo['librariesInstalled'] = $this->getLibrariesInstalled(); // Adding random string to GET to be sure nothing is cached $random = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5); From 36c8bf33624e7e11830a53222476eb11dd8c99ba Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 10 Mar 2016 14:14:33 +0100 Subject: [PATCH 3/5] Revert "HFJ-1610 - Track number of contents per library type." This reverts commit 2e0498cd3acc1e9962cd7d4ccc6bc7f72c45fa83. --- h5p.classes.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index b79909e..c5cffcf 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -334,16 +334,6 @@ interface H5PFrameworkInterface { */ public function getLibraryUsage($libraryId); - /** - * Get a key value list of library version and count of content created - * using that library. - * - * @return array - * Array containing library, major and minor version - content count - * e.g. "H5P.CoursePresentation 1.6" => "14" - */ - public function getLibraryContentCount(); - /** * Loads a library * @@ -2415,7 +2405,6 @@ class H5PCore { $platformInfo['autoFetchingDisabled'] = $fetchingDisabled; $platformInfo['uuid'] = $this->h5pF->getOption('site_uuid', ''); $platformInfo['siteType'] = $this->h5pF->getOption('site_type', 'local'); - $platformInfo['libraryContentCount'] = $this->h5pF->getLibraryContentCount(); // Adding random string to GET to be sure nothing is cached $random = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5); From 5b965636e02af9f2fca2730546e5a889194f14f9 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 10 Mar 2016 14:14:39 +0100 Subject: [PATCH 4/5] Revert "HFJ-1610 - Gather statistics on dev or prod server." This reverts commit 9b76fccfcecb223dbd5129e5baa379e0dcea8708. --- h5p.classes.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index c5cffcf..1765f10 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1700,8 +1700,6 @@ class H5PCore { if ($development_mode & H5PDevelopment::MODE_LIBRARY) { $this->h5pD = new H5PDevelopment($this->h5pF, $path . '/', $language); } - - $this->detectSiteType(); } /** @@ -2372,29 +2370,6 @@ class H5PCore { return $html; } - /** - * Detects if the site was accessed from localhost, - * through a local network or from the internet. - */ - public function detectSiteType() { - $type = $this->h5pF->getOption('site_type', 'local'); - - // Determine remote/visitor origin - $localhostPattern = '/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i'; - - // localhost - if ($type !== 'internet' && !preg_match($localhostPattern, $_SERVER['REMOTE_ADDR'])) { - if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) { - // Internet - $this->h5pF->setOption('site_type', 'internet'); - } - elseif ($type === 'local') { - // Local network - $this->h5pF->setOption('site_type', 'network'); - } - } - } - /** * Fetch a list of libraries' metadata from h5p.org. * Save URL tutorial to database. Each platform implementation @@ -2404,8 +2379,6 @@ class H5PCore { $platformInfo = $this->h5pF->getPlatformInfo(); $platformInfo['autoFetchingDisabled'] = $fetchingDisabled; $platformInfo['uuid'] = $this->h5pF->getOption('site_uuid', ''); - $platformInfo['siteType'] = $this->h5pF->getOption('site_type', 'local'); - // Adding random string to GET to be sure nothing is cached $random = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5); $json = $this->h5pF->fetchExternalData('http://h5p.org/libraries-metadata.json?api=1&platform=' . urlencode(json_encode($platformInfo)) . '&x=' . urlencode($random)); From de175737ea53a142b8952f1182f26ba33d056cdb Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 10 Mar 2016 16:33:53 +0100 Subject: [PATCH 5/5] Use correct variable --- h5p.classes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index af78c0e..4b2b3a4 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2546,7 +2546,7 @@ class H5PCore { $response = array( 'success' => TRUE ); - if ($message !== NULL) { + if ($data !== NULL) { $response['data'] = $data; } self::printJson($response);