Skip to content

Commit

Permalink
MDL-22631 Added some clean_param calls to clean the $_GET data and al…
Browse files Browse the repository at this point in the history
…so added lots of warnings and info there.
  • Loading branch information
moodler committed Jun 1, 2010
1 parent 1bdb4ed commit e595058
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions blog/lib.php
Expand Up @@ -659,17 +659,20 @@ function get_viewable_entry_count($postid='', $fetchlimit=10,


/// Find the base url from $_GET variables, for print_paging_bar
/// WARNING: EVIL EVIL EVIL! This function directly acesses $_GET which is a big no no. MDL-22631
/// I added some clean_param() calls for now but $_GET should just not ever be used directly.
/// The function is totally gone in Moodle 2.0.
function get_baseurl($filtertype, $filterselect) {

$getcopy = $_GET;

unset($getcopy['blogpage']);
unset($_GET['blogpage']);

$strippedurl = strip_querystring(qualified_me());
if(!empty($getcopy)) {
if(!empty($_GET)) {
$first = false;
$querystring = '';
foreach($getcopy as $var => $val) {
foreach($_GET as $var => $val) {
$var = clean_param($var, PARAM_ALPHANUM); // See MDL-22631
$val = clean_param($val, PARAM_CLEAN);
if(!$first) {
$first = true;
if ($var != 'filterselect' && $var != 'filtertype') {
Expand All @@ -680,8 +683,8 @@ function get_baseurl($filtertype, $filterselect) {
}
} else {
if ($var != 'filterselect' && $var != 'filtertype') {
$querystring .= '&'.$var.'='.$val;
$hasparam = true;
$querystring .= '&'.$var.'='.$val;
$hasparam = true;
}
}
}
Expand Down

0 comments on commit e595058

Please sign in to comment.