diff options
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r-- | inc/pageutils.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php index c9bf60135..81dcb66e7 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -295,8 +295,6 @@ function wikiLockFN($id) { /** * returns the full path to the meta file specified by ID and extension * - * The filename is URL encoded to protect Unicode chars - * * @author Steven Danz <steven-danz@kc.rr.com> */ function metaFN($id,$ext){ @@ -308,6 +306,19 @@ function metaFN($id,$ext){ } /** + * returns the full path to the media's meta file specified by ID and extension + * + * @author Kate Arzamastseva <pshns@ukr.net> + */ +function mediaMetaFN($id,$ext){ + global $conf; + $id = cleanID($id); + $id = str_replace(':','/',$id); + $fn = $conf['mediametadir'].'/'.utf8_encodeFN($id).$ext; + return $fn; +} + +/** * returns an array of full paths to all metafiles of a given ID * * @author Esther Brunner <esther@kaffeehaus.ch> @@ -326,12 +337,19 @@ function metaFiles($id){ * The filename is URL encoded to protect Unicode chars * * @author Andreas Gohr <andi@splitbrain.org> + * @author Kate Arzamastseva <pshns@ukr.net> */ -function mediaFN($id){ +function mediaFN($id, $rev=''){ global $conf; $id = cleanID($id); $id = str_replace(':','/',$id); - $fn = $conf['mediadir'].'/'.utf8_encodeFN($id); + if(empty($rev)){ + $fn = $conf['mediadir'].'/'.utf8_encodeFN($id); + }else{ + $ext = mimetype($id); + $name = substr($id,0, -1*strlen($ext[0])-1); + $fn = $conf['mediaolddir'].'/'.utf8_encodeFN($name .'.'.( (int) $rev ).'.'.$ext[0]); + } return $fn; } |