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