summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-06-23 19:20:20 +0200
committerAndreas Gohr <andi@splitbrain.org>2008-06-23 19:20:20 +0200
commitb80bedd6525e59ec7dd21aa8156d2575944f101e (patch)
treee509446ca29822d0166cfeac73971b1bd1fa9bf8 /lib/exe
parent7ba41511741314d7794b52ddfc460681087be0d8 (diff)
downloadrpg-b80bedd6525e59ec7dd21aa8156d2575944f101e.tar.gz
rpg-b80bedd6525e59ec7dd21aa8156d2575944f101e.tar.bz2
MEDIA_SENDFILE event added
This new event wraps around the sendFile function in lib/exe/fetch.php and allows intercepting mediafile downloads. darcs-hash:20080623172020-7ad00-c71293c9ebbbce7559e4b34e878d364a555ebfa2.gz
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/fetch.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index cdcc4dd21..c39e21173 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -65,6 +65,8 @@
exit;
}
+ $ORIG = $FILE;
+
//handle image resizing/cropping
if((substr($MIME,0,5) == 'image') && $WIDTH){
if($HEIGHT){
@@ -75,7 +77,18 @@
}
// finally send the file to the client
- sendFile($FILE,$MIME,$CACHE);
+ $data = array('file' => $FILE,
+ 'mime' => $MIME,
+ 'cache' => $CACHE,
+ 'orig' => $ORIG,
+ 'ext' => $EXT,
+ 'width' => $WIDTH,
+ 'height' => $HEIGHT);
+
+ $evt = new Doku_Event('MEDIA_SENDFILE', $data);
+ if ($evt->advise_before()) {
+ sendFile($data['file'],$data['mime'],$data['cache']);
+ }
/* ------------------------------------------------------------------------ */