Skip to content

Commit

Permalink
Changes since 1.13.2.4 upto 1.13.2.9 in MOODLE_14_STABLE
Browse files Browse the repository at this point in the history
applied to HEAD!!!

Some validation code has changed and I've leave it commented
exactly as it's in MOODLE_14_STABLE. Not sure why!!
  • Loading branch information
stronk7 committed Dec 17, 2004
1 parent f1e006f commit b7237c1
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions mod/scorm/lib.php
Expand Up @@ -19,12 +19,14 @@
}
if (!isset($CFG->scorm_validate)) {
$scorm_validate = 'none';
if (extension_loaded('domxml')) {
$scorm_validate = 'domxml';
}
if (version_compare(phpversion(),'5.0.0','>=')) {
$scorm_validate = 'php5';
}
//I've commented this out for Moodle 1.4, as I've seen errors in
//SCORM packages even though the actual package worked fine. -- Martin Dougiamas
//if (extension_loaded('domxml') && version_compare(phpversion(),'5.0.0','<')) {
// $scorm_validate = 'domxml';
//}
//if (version_compare(phpversion(),'5.0.0','>=')) {
// $scorm_validate = 'php5';
//}
set_config('scorm_validate', $scorm_validate);
}

Expand Down Expand Up @@ -366,15 +368,12 @@ function scorm_validate($manifest)
}
}

function scorm_delete_files($directory)
{
if (is_dir($directory))
{
$handle=opendir($directory);
while (($file = readdir($handle)) != '')
{
if ($file != '.' && $file != '..')
{
function scorm_delete_files($directory) {
if (is_dir($directory)) {
$files=scorm_scandir($directory);
//print_r($files);
foreach($files as $file) {
if (($file != '.') && ($file != '..')) {
if (!is_dir($directory.'/'.$file)) {
//chmod($directory.'/'.$file,0777);
unlink($directory.'/'.$file);
Expand All @@ -387,6 +386,21 @@ function scorm_delete_files($directory)
}
}

function scorm_scandir($directory) {
if (version_compare(phpversion(),'5.0.0','>=')) {
return scandir($directory);
} else {
$files = null;
if ($dh = opendir($directory)) {
while (($file = readdir($dh)) !== false) {
$files[] = $file;
}
closedir($dh);
}
return $files;
}
}

function scorm_startElement($parser, $name, $attrs) {

global $scoes,$i,$resources,$parent,$level,$organization,$manifest,$defaultorg;
Expand Down Expand Up @@ -465,7 +479,7 @@ function scorm_endElement($parser, $name) {

function scorm_characterData($parser, $data) {
global $datacontent;
$datacontent = $data;
$datacontent = utf8_decode($data);
}

function scorm_parse($basedir,$file,$scorm_id) {
Expand Down

0 comments on commit b7237c1

Please sign in to comment.