]> _ Git - cubist_scorm.git/commitdiff
wip #7586 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Jun 2025 16:30:29 +0000 (18:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Jun 2025 16:30:29 +0000 (18:30 +0200)
src/Manifest.php

index 4d6b0051329b1fc5b7a06b13ce3c4eb56d164ca5..a290df31c8d96f2e1d9354b50260ca33e2c08dc4 100644 (file)
@@ -84,8 +84,8 @@ class Manifest
         <schema>ADL SCORM</schema>
         <schemaversion>2004 ' . $v . ' Edition</schemaversion>
     </metadata>
-    <organizations default="' . $this->_escapeAttr($this->getOrganization()) . '">
-        <organization identifier="' . $this->_escapeAttr($this->getOrganization()) . '" adlseq:objectivesGlobalToSystem="false">
+    <organizations default="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '">
+        <organization identifier="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '" adlseq:objectivesGlobalToSystem="false">
             <title>' . $this->_escape($this->getTitle()) . '</title>
             <item identifier="' . $this->_escapeAttr($this->getReference()) . '" identifierref="' . $this->_escapeAttr($this->getReference()) . '_RES" isvisible="true">
                 <title>' . $this->_escape($this->getTitle()) . '</title>
@@ -133,8 +133,8 @@ class Manifest
         <schema>ADL SCORM</schema>
         <schemaversion>1.2</schemaversion>
     </metadata>
-    <organizations default="' . $this->_escapeAttr($this->getOrganization()) . '">
-        <organization identifier="' . $this->_escapeAttr($this->getOrganization()) . '" structure="hierarchical">
+    <organizations default="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '">
+        <organization identifier="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '" structure="hierarchical">
             <title>' . $this->_escape($this->getTitle()) . '</title>
             <item identifier="' . $this->_escapeAttr($this->getReference()) . '" identifierref="' . $this->_escapeAttr($this->getReference()) . '_RES" isvisible="true">
                 <title>' . $this->_escape($this->getTitle()) . '</title>
@@ -151,6 +151,11 @@ class Manifest
         return $res;
     }
 
+    protected function _escapeOrganization($org)
+    {
+        return preg_replace('/[^a-z0-9_]/i', '', $org);
+    }
+
     protected function _escape($string, $flags = ENT_XML1)
     {
         return htmlspecialchars($string, $flags);