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