From a4bb739b92865b3929d277df9a407004bf749cb5 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 5 May 2009 09:25:59 +0000 Subject: [PATCH] MDL-18799 backup of file.php links - now using unicode modifiers if allowed in the server --- backup/backuplib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index fd764326c61..bcc58371550 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -2323,6 +2323,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 @@ -2346,7 +2352,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))(?:(?:\([-;:@#&=a-zA-Z0-9\$~_.+!*\',]*?\))|[-;:@#&=a-zA-Z0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*)?(\?(?:(?:(?:\([-;:@#&=a-zA-Z0-9\$~_.+!*\',]*?\))|[-;:@#&=?a-zA-Z0-9\$~_.+!*\',]|%[a-fA-F0-9]{2}|\/)*))?(?mods as $name => $info) {