From f9ff3eb9aadafd786cef1d607d5a238daef25e9b Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 10 May 2007 19:08:09 +0200 Subject: [PATCH] [svn r12369] Updated messaging on unrecognized format. Fixed a bug in preg_match expression whereby most packages were attributed 'aicc' type for no reason. --- main/newscorm/learnpath.class.php | 4 ++-- main/upload/upload.scorm.php | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 1e3399156b..1e5330831e 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1739,8 +1739,8 @@ class learnpath { $package_type = 'scorm'; break;//exit the foreach loop } - elseif(preg_match('/aicc\//i',$thisContent['filename'])!==FALSE) - {//if found an aicc directory... + elseif(preg_match('/aicc\//i',$thisContent['filename'])!=false) + {//if found an aicc directory... (!= false means it cannot be false (error) or 0 (no match)) $package_type='aicc'; //break;//don't exit the loop, because if we find an imsmanifest afterwards, we want it, not the AICC } diff --git a/main/upload/upload.scorm.php b/main/upload/upload.scorm.php index 223c312743..82001e3bd1 100644 --- a/main/upload/upload.scorm.php +++ b/main/upload/upload.scorm.php @@ -8,9 +8,17 @@ /** * Process the SCORM package and return to the SCORM tool */ +$language_file = "scorm"; $cwdir = getcwd(); require('../newscorm/lp_upload.php'); //reinit current working directory as many functions in upload change it chdir($cwdir); -header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.urlencode(get_lang('UplUploadSucceeded'))); +$error = api_failure::get_last_failure(); +if($error=='not_a_learning_path') +{ + $msg = urlencode(get_lang('UnknownPackageFormat')); +}else{ + $msg = urlencode(get_lang('UplUploadSucceeded')); +} +header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.$msg); ?> \ No newline at end of file