diff options
author | Klap-in <klapinklapin@gmail.com> | 2013-06-09 21:22:12 +0200 |
---|---|---|
committer | Klap-in <klapinklapin@gmail.com> | 2013-06-09 21:22:12 +0200 |
commit | 9b6fa49c06b538c53c9cf3e404ade82d6c003f79 (patch) | |
tree | 68771b589052382f9e4824bf3a4857f5648fdf3d /inc/common.php | |
parent | a38a6f25d7e46f47a8f358bb16c766f5b96dae45 (diff) | |
parent | 62765857f84626449d6c53b1a46c462a37e5083a (diff) | |
download | rpg-9b6fa49c06b538c53c9cf3e404ade82d6c003f79.tar.gz rpg-9b6fa49c06b538c53c9cf3e404ade82d6c003f79.tar.bz2 |
Merge remote-tracking branch 'origin/master' into fetchimagetokexternal
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/inc/common.php b/inc/common.php index 4d939ac77..59ceb0c0d 100644 --- a/inc/common.php +++ b/inc/common.php @@ -56,7 +56,7 @@ function stripctl($string) { * @return string */ function getSecurityToken() { - return md5(auth_cookiesalt().session_id().$_SERVER['REMOTE_USER']); + return PassHash::hmac('md5', session_id().$_SERVER['REMOTE_USER'], auth_cookiesalt()); } /** @@ -435,6 +435,11 @@ function exportlink($id = '', $format = 'raw', $more = '', $abs = false, $sep = */ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) { global $conf; + $isexternalimage = preg_match('#^(https?|ftp)://#i', $id); + if(!$isexternalimage) { + $id = cleanID($id); + } + if(is_array($more)) { // add token for resized images if($more['w'] || $more['h']){ @@ -467,10 +472,10 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) } // external URLs are always direct without rewriting - if(preg_match('#^(https?|ftp)://#i', $id)) { + if($isexternalimage) { $xlink .= 'lib/exe/fetch.php'; // add hash: - $xlink .= '?hash='.substr(md5(auth_cookiesalt().$id), 0, 6); + $xlink .= '?hash='.substr(PassHash::hmac('md5', $id, auth_cookiesalt()), 0, 6); if($more) { $xlink .= $sep.$more; $xlink .= $sep.'media='.rawurlencode($id); |