Skip to content

Commit

Permalink
MDL-51015 mod_scorm: tidy up messy code, remove use of eval()
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden committed Aug 6, 2015
1 parent 57739a7 commit 524aaa1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mod/scorm/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 524aaa1

Please sign in to comment.