Skip to content

Commit

Permalink
MDL-15683, get query string instead of calling me(), merged from MOOD…
Browse files Browse the repository at this point in the history
…LE_19_STABLE.
  • Loading branch information
dongsheng committed Jul 17, 2008
1 parent 343b8ba commit 23634bc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pix/smartpix.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function makesafe($param) {
* @param string $url the url which may have a query string attached
* @return string
*/
function strip_querystring($url) {
function strip_querystring($url) {

if ($commapos = strpos($url, '?')) {
return substr($url, 0, $commapos);
Expand All @@ -45,6 +45,16 @@ function strip_querystring($url) {
}
}

// get query string
function get_query($name) {
if (!empty($_SERVER['REQUEST_URI'])) {
return explode($name, $_SERVER['REQUEST_URI']);
} else if (!empty($_SERVER['QUERY_STRING'])) {
return array('', '?'. $_SERVER['QUERY_STRING']);
} else {
return false;
}
}
// Nicked from weblib then cutdown
/**
* Extracts file argument either from file parameter or PATH_INFO.
Expand All @@ -70,7 +80,7 @@ function get_file_argument_limited($scriptname) {

// now if both fail try the old way
// (for compatibility with misconfigured or older buggy php implementations)
$arr = explode($scriptname, me());
$arr = get_query($scriptname);
if (!empty($arr[1])) {
return makesafe(rawurldecode(strip_querystring($arr[1])));
}
Expand Down

0 comments on commit 23634bc

Please sign in to comment.