From: stronk7 Date: Tue, 5 May 2009 09:26:47 +0000 (+0000) Subject: MDL-18799 backup of file.php links - now using unicode modifiers if allowed in the... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0287b9a6494079376d7621b55a56bc3dc3aacdda;p=moodle.git MDL-18799 backup of file.php links - now using unicode modifiers if allowed in the server ; merged from 19_STABLE --- diff --git a/backup/backuplib.php b/backup/backuplib.php index 43234c6927..d11e509600 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -2339,6 +2339,12 @@ $includedfiles = array(); } + //Check if we support unicode modifiers in regular expressions. Cache it. + static $unicoderegexp; + if (!isset($unicoderegexp)) { + $unicoderegexp = @preg_match('/\pL/u', 'a'); // This will fail silenty, returning false, + } // if regexp libraries don't support unicode + //Check if preferences is ok. If it isn't set, we are //in a scheduled_backup to we are able to get a copy //from CFG->backup_preferences @@ -2362,7 +2368,12 @@ // - slashes and %2F by $@SLASH@$ // - &forcedownload=1 &forcedownload=1 and ?forcedownload=1 by $@FORCEDOWNLOAD@$ // This way, backup contents will be neutral and independent of slasharguments configuration. MDL-18799 - $search = '/(\$@FILEPHP@\$)((?:(?:\/|%2f|%2F))(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*)?(\?(?:(?:(?:\([-;:@#&=\pL0-9\$~_.+!*\',]*?\))|[-;:@#&=?\pL0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*))?(?mods as $name => $info) {