Skip to content

Commit

Permalink
Check passed in policy ID is an integer.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Apr 9, 2024
1 parent 7c2064a commit 24e608e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions www/docs/mp/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ function($k) { return $k['score_difference'] >= 2; }

case 'divisions':
$policyID = get_http_var('policy');
if (!ctype_digit($policyID)) {
member_redirect($MEMBER);
}
if ( $policyID ) {
$policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
} else {
Expand Down Expand Up @@ -590,18 +593,16 @@ function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
$params = array();
foreach ($_GET as $key => $value) {
if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') {
$params[] = "$key=$value";
$params[] = urlencode($key) . "=" . urlencode($value);
}
}
if ($pagetype) {
$url .= '/' . $pagetype;
}
if (count($params)) {
$url .= '?' . join('&', $params);
}
if ($pagetype) {
$pagetype = '/' . $pagetype;
} else {
$pagetype = '';
}
header('Location: ' . $url . $pagetype, true, $code );
header('Location: ' . $url, true, $code );
exit;
}
}
Expand Down

0 comments on commit 24e608e

Please sign in to comment.