$CACHE = calc_cache($INPUT->str('cache')); $WIDTH = $INPUT->int('w'); $HEIGHT = $INPUT->int('h'); $REV =& $INPUT->ref('rev'); //sanitize revision $REV = preg_replace('/[^0-9]/', '', $REV); list($EXT, $MIME, $DL) = mimetype($MEDIA, false); if ($EXT === false) { $EXT = 'unknown'; $MIME = 'application/octet-stream'; $DL = true; } // check for permissions, preconditions and cache external files list($STATUS, $STATUSMESSAGE) = checkFileStatus($MEDIA, $FILE, $REV, $WIDTH, $HEIGHT); // prepare data for plugin events $data = array('media' => $MEDIA, 'file' => $FILE, 'orig' => $FILE, 'mime' => $MIME, 'download' => $DL, 'cache' => $CACHE, 'ext' => $EXT, 'width' => $WIDTH, 'height' => $HEIGHT, 'status' => $STATUS, 'statusmessage' => $STATUSMESSAGE, 'ispublic' => media_ispublic($MEDIA)); // handle the file status $evt = new Doku_Event('FETCH_MEDIA_STATUS', $data); if ($evt->advise_before()) { // redirects if ($data['status'] > 300 && $data['status'] <= 304) { send_redirect($data['statusmessage']); } // send any non 200 status if ($data['status'] != 200) { http_status($data['status'], $data['statusmessage']); } // die on errors if ($data['status'] > 203) { print $data['statusmessage']; if (defined('SIMPLE_TEST')) {
public function test_internal() { $this->assertTrue(media_ispublic('wiki:logo.png')); $this->assertFalse(media_ispublic('private:logo.png')); }