diff options
author | Anika Henke <anika@selfthinker.org> | 2013-08-04 10:41:00 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2013-08-04 10:41:00 +0100 |
commit | 71c1143e8785954ea00a62aeb755ca7d8fa47e56 (patch) | |
tree | c813b1fe3590314fcb1f20a30811d5de92871583 /inc/common.php | |
parent | d637819dca760b20f6e53e5847a92d08d8d15b8c (diff) | |
parent | 90d5fa676926189b265430239dca3b7ba668b30b (diff) | |
download | rpg-71c1143e8785954ea00a62aeb755ca7d8fa47e56.tar.gz rpg-71c1143e8785954ea00a62aeb755ca7d8fa47e56.tar.bz2 |
Merge remote-tracking branch 'origin/master' into video-audio
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/inc/common.php b/inc/common.php index bff6e80de..3312141c8 100644 --- a/inc/common.php +++ b/inc/common.php @@ -148,7 +148,7 @@ function pageinfo() { $info['id'] = $ID; $info['rev'] = $REV; - if(isset($_SERVER['REMOTE_USER'])) {
+ if(isset($_SERVER['REMOTE_USER'])) { $sub = new Subscription(); $info['subscribed'] = $sub->user_subscription(); } else { @@ -474,7 +474,7 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) if(is_array($more)) { // add token for resized images - if($more['w'] || $more['h']){ + if($more['w'] || $more['h'] || $isexternalimage){ $more['tok'] = media_get_token($id,$more['w'],$more['h']); } // strip defaults for shorter URLs @@ -485,12 +485,13 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) $more = buildURLparams($more, $sep); } else { $matches = array(); - if (preg_match_all('/\b(w|h)=(\d*)\b/',$more,$matches,PREG_SET_ORDER)){ + if (preg_match_all('/\b(w|h)=(\d*)\b/',$more,$matches,PREG_SET_ORDER) || $isexternalimage){ $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 .= $more === '' ? '' : $sep; + $more .= 'tok='.media_get_token($id,$resize['w'],$resize['h']); } $more = str_replace('cache=cache', '', $more); //skip default $more = str_replace(',,', ',', $more); @@ -506,14 +507,8 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) // external URLs are always direct without rewriting if($isexternalimage) { $xlink .= 'lib/exe/fetch.php'; - // add hash: - $xlink .= '?hash='.substr(PassHash::hmac('md5', $id, auth_cookiesalt()), 0, 6); - if($more) { - $xlink .= $sep.$more; - $xlink .= $sep.'media='.rawurlencode($id); - } else { - $xlink .= $sep.'media='.rawurlencode($id); - } + $xlink .= '?'.$more; + $xlink .= $sep.'media='.rawurlencode($id); return $xlink; } |