Commit b62e5522 authored by Markus Staab's avatar Markus Staab Committed by Dave Methvin

Fix #12554. Sanitize data from POST. Close gh-908.

parent 5fb258b8
...@@ -131,4 +131,5 @@ Chris Faulkner <thefaulkner@gmail.com> ...@@ -131,4 +131,5 @@ Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com> Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com> Daniel Chatfield <chatfielddaniel@googlemail.com>
Nikita Govorov <nikita.govorov@gmail.com> Nikita Govorov <nikita.govorov@gmail.com>
Mike Pennisi <mike@mikepennisi.com> Mike Pennisi <mike@mikepennisi.com>
\ No newline at end of file Markus Staab <markus.staab@redaxo.de>
\ No newline at end of file
...@@ -42,11 +42,22 @@ ...@@ -42,11 +42,22 @@
if( count($_POST) ) { if( count($_POST) ) {
$includes = array(); $includes = array();
foreach( $_POST as $name => $ver ){ foreach( $_POST as $name => $ver ){
if ( empty( $libraries[ $name ] )) {
echo "unsupported library ". $name;
exit;
}
$url = $libraries[ $name ][ "url" ]; $url = $libraries[ $name ][ "url" ];
if( $name == "YUI" && $ver[0] == "2" ) { if( $name == "YUI" && $ver[0] == "2" ) {
$url = str_replace( "/yui", "/yuiloader", $url, $count = 2 ); $url = str_replace( "/yui", "/yuiloader", $url);
}
if ( empty( $libraries[ $name ][ "versions" ][ $ver ] )) {
echo "library ". $name ." not supported in version ". $ver;
exit;
} }
$include = "<script src='$baseURL".str_replace("XYZ", $ver, $url, $count = 1)."'></script>\n";
$include = "<script src='$baseURL".str_replace("XYZ", $ver, $url)."'></script>\n";
if( $lib == "prototype" ) { // prototype must be included first if( $lib == "prototype" ) { // prototype must be included first
array_unshift( $includes, $include ); array_unshift( $includes, $include );
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment