xref: /dokuwiki/lib/exe/detail.php (revision 94070874cc8d8702821161dbaa291e8b2d043ad3)
1<?php
2if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
3define('DOKU_MEDIADETAIL',1);
4require_once(DOKU_INC.'inc/init.php');
5
6$IMG  = getID('media');
7$ID   = cleanID($INPUT->str('id'));
8
9// this makes some general info available as well as the info about the
10// "parent" page
11$INFO = array_merge(pageinfo(),mediainfo());
12
13$tmp = array();
14trigger_event('DETAIL_STARTED', $tmp);
15
16//close session
17session_write_close();
18
19if($conf['allowdebug'] && $INPUT->has('debug')){
20    print '<pre>';
21    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
22        print '$'."conf['$x'] = '".$conf[$x]."';\n";
23    }
24    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
25                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
26        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
27    }
28    print "getID('media'): ".getID('media')."\n";
29    print "getID('media',false): ".getID('media',false)."\n";
30    print '</pre>';
31}
32
33$ERROR = false;
34// check image permissions
35$AUTH = auth_quickaclcheck($IMG);
36if($AUTH >= AUTH_READ){
37    // check if image exists
38    $SRC = mediaFN($IMG);
39    if(!@file_exists($SRC)){
40        //doesn't exist!
41        http_status(404);
42        $ERROR = 'File not found';
43    }
44}else{
45    // no auth
46    $ERROR = p_locale_xhtml('denied');
47}
48
49//start output and load template
50header('Content-Type: text/html; charset=utf-8');
51include(template('detail.php'));
52
53