Apply rector fixes to lib/exe
[dokuwiki.git] / lib / exe / detail.php
blobdbe94de646127b3db2587878eff669341e6fd269
1 <?php
3 use dokuwiki\Extension\Event;
5 if(!defined('DOKU_INC')) define('DOKU_INC',__DIR__.'/../../');
6 if(!defined('DOKU_MEDIADETAIL')) define('DOKU_MEDIADETAIL',1);
8 // define all DokuWiki globals here (needed within test requests but also helps to keep track)
9 global $INPUT, $IMG, $ID, $REV, $SRC, $ERROR, $AUTH;
11 require_once(DOKU_INC.'inc/init.php');
13 $IMG = getID('media');
14 $ID = cleanID($INPUT->str('id'));
15 $REV = $INPUT->int('rev');
17 // this makes some general info available as well as the info about the
18 // "parent" page
19 $INFO = array_merge(pageinfo(),mediainfo());
21 $tmp = [];
22 Event::createAndTrigger('DETAIL_STARTED', $tmp);
24 //close session
25 session_write_close();
27 $ERROR = false;
28 // check image permissions
29 $AUTH = auth_quickaclcheck($IMG);
30 if($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';
38 }else{
39 // no auth
40 $ERROR = p_locale_xhtml('denied');
43 //start output and load template
44 header('Content-Type: text/html; charset=utf-8');
45 include(template('detail.php'));
46 tpl_img_close();