From 524aaa177a5319bbe945f93121b8e1b9fb28b4c6 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 6 Aug 2015 22:20:05 +1200 Subject: [PATCH] MDL-51015 mod_scorm: tidy up messy code, remove use of eval() --- mod/scorm/locallib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 747213755b4..f3ba52558aa 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -1303,7 +1303,7 @@ function scorm_get_attempt_count($userid, $scorm, $returnobjects = false, $ignor * @return boolean - debugging true/false */ function scorm_debugging($scorm) { - global $CFG, $USER; + global $USER; $cfgscorm = get_config('scorm'); if (!$cfgscorm->allowapidebug) { @@ -1315,9 +1315,11 @@ function scorm_debugging($scorm) { if (!preg_match('/^[\w\s\*\.\?\+\:\_\\\]+$/', $test)) { return false; } - $res = false; - eval('$res = preg_match(\'/^'.$test.'/\', $identifier) ? true : false;'); - return $res; + + if (preg_match('/^'.$test.'/', $identifier)) { + return true; + } + return false; } /**