Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 82... Línea 82...
82
        '\batchmode', '\read', '\write', 'csname', '\newhelp', '\uppercase',
82
        '\batchmode', '\read', '\write', 'csname', '\newhelp', '\uppercase',
83
        '\lowercase', '\relax', '\aftergroup',
83
        '\lowercase', '\relax', '\aftergroup',
84
        '\afterassignment', '\expandafter', '\noexpand', '\special',
84
        '\afterassignment', '\expandafter', '\noexpand', '\special',
85
        '\let', '\futurelet', '\else', '\fi', '\chardef', '\makeatletter', '\afterground',
85
        '\let', '\futurelet', '\else', '\fi', '\chardef', '\makeatletter', '\afterground',
86
        '\noexpand', '\line', '\mathcode', '\item', '\section', '\mbox', '\declarerobustcommand',
86
        '\noexpand', '\line', '\mathcode', '\item', '\section', '\mbox', '\declarerobustcommand',
87
        '\ExplSyntaxOn', '\pdffiledump',
87
        '\ExplSyntaxOn', '\pdffiledump', '\mathtex',
88
    ];
88
    ];
Línea 89... Línea 89...
89
 
89
 
Línea -... Línea 90...
-
 
90
    $allowlist = ['inputenc'];
-
 
91
 
-
 
92
    // Add encoded backslash (\) versions of backslashed items to deny list.
-
 
93
    $encodedslashdenylist = array_map(function($value) {
-
 
94
        $encoded = str_replace('\\', '\', $value);
-
 
95
        // Return an encoded slash version if a slash is found, otherwise null so we can filter it off.
-
 
96
        return $encoded != $value ? $encoded : null;
-
 
97
    }, $denylist);
-
 
98
    $encodedslashdenylist = array_filter($encodedslashdenylist);
90
    $allowlist = ['inputenc'];
99
    $denylist = array_merge($denylist, $encodedslashdenylist);
91
 
100
 
92
    // Prepare the denylist for regular expression.
101
    // Prepare the denylist for regular expression.
93
    $denylist = array_map(function($value){
102
    $denylist = array_map(function($value){
Línea 100... Línea 109...
100
    }, $allowlist);
109
    }, $allowlist);
Línea 101... Línea 110...
101
 
110
 
102
    // First, mangle all denied words.
111
    // First, mangle all denied words.
103
    $texexp = preg_replace_callback($denylist,
112
    $texexp = preg_replace_callback($denylist,
-
 
113
        function($matches) {
-
 
114
            // Remove backslashes to make commands impotent.
104
        function($matches) {
115
            $noslashes = str_replace('\\', '', $matches[0]);
105
            return 'forbiddenkeyword_' . $matches[0];
116
            return 'forbiddenkeyword_' . $noslashes;
106
        },
117
        },
107
        $texexp
118
        $texexp
Línea 108... Línea 119...
108
    );
119
    );