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