summaryrefslogtreecommitdiff
path: root/lib/exe/detail.php
blob: cd3f362ad69b460016ce9e1e055e3db2da0a503e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
define('DOKU_MEDIADETAIL',1);
require_once(DOKU_INC.'inc/init.php');

$IMG  = getID('media');
$ID   = cleanID($INPUT->str('id'));

// this makes some general info available as well as the info about the
// "parent" page
$INFO = array_merge(pageinfo(),mediainfo());

$tmp = array();
trigger_event('DETAIL_STARTED', $tmp);

//close session
session_write_close();

if($conf['allowdebug'] && $INPUT->has('debug')){
    print '<pre>';
    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
        print '$'."conf['$x'] = '".$conf[$x]."';\n";
    }
    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
    }
    print "getID('media'): ".getID('media')."\n";
    print "getID('media',false): ".getID('media',false)."\n";
    print '</pre>';
}

$ERROR = false;
// check image permissions
$AUTH = auth_quickaclcheck($IMG);
if($AUTH >= AUTH_READ){
    // check if image exists
    $SRC = mediaFN($IMG);
    if(!@file_exists($SRC)){
        //doesn't exist!
        http_status(404);
        $ERROR = 'File not found';
    }
}else{
    // no auth
    $ERROR = p_locale_xhtml('denied');
}

//start output and load template
header('Content-Type: text/html; charset=utf-8');
include(template('detail.php'));