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