Skip to content

Commit

Permalink
ensure security token is included in media url when resize parameter …
Browse files Browse the repository at this point in the history
…is passed in string form, e.g. 'w=80'
  • Loading branch information
Chris--S committed May 6, 2013
1 parent a3d0aa2 commit 5e7db1e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/common.php
Expand Up @@ -447,6 +447,14 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false)
if(isset($more['id']) && $direct) unset($more['id']);
$more = buildURLparams($more, $sep);
} else {
$matches = array();
if (preg_match_all('/\b(w|h)=(\d*)\b/',$more,$matches,PREG_SET_ORDER)){
$resize = array('w'=>0, 'h'=>0);
foreach ($matches as $match){
$resize[$match[1]] = $match[2];
}
$more .= $sep.'tok='.media_get_token($id,$resize['w'],$resize['h']);
}
$more = str_replace('cache=cache', '', $more); //skip default
$more = str_replace(',,', ',', $more);
$more = str_replace(',', $sep, $more);
Expand Down

0 comments on commit 5e7db1e

Please sign in to comment.