1<?php 2 3use dokuwiki\Extension\Event; 4 5if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../'); 6if (!defined('DOKU_MEDIADETAIL')) define('DOKU_MEDIADETAIL', 1); 7 8// define all DokuWiki globals here (needed within test requests but also helps to keep track) 9global $INPUT, $IMG, $ID, $REV, $SRC, $ERROR, $AUTH; 10 11require_once(DOKU_INC . 'inc/init.php'); 12 13$IMG = getID('media'); 14$ID = cleanID($INPUT->str('id')); 15$REV = $INPUT->int('rev'); 16 17// this makes some general info available as well as the info about the 18// "parent" page 19$INFO = array_merge(pageinfo(), mediainfo()); 20 21$tmp = []; 22Event::createAndTrigger('DETAIL_STARTED', $tmp); 23 24//close session 25session_write_close(); 26 27$ERROR = false; 28// check image permissions 29$AUTH = auth_quickaclcheck($IMG); 30if ($AUTH >= AUTH_READ) { 31 // check if image exists 32 $SRC = mediaFN($IMG, $REV); 33 if (!file_exists($SRC)) { 34 //doesn't exist! 35 http_status(404); 36 $ERROR = 'File not found'; 37 } 38} else { 39 // no auth 40 $ERROR = p_locale_xhtml('denied'); 41} 42 43//start output and load template 44header('Content-Type: text/html; charset=utf-8'); 45include(template('detail.php')); 46tpl_img_close(); 47