xref: /dokuwiki/lib/exe/detail.php (revision 5c2eed9a193e9341fbfee63d4a973898acdc5ee5)
155efc227SAndreas Gohr<?php
2d0a27cb0SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
37a24876fSAndreas Gohrdefine('DOKU_MEDIADETAIL',1);
455efc227SAndreas Gohrrequire_once(DOKU_INC.'inc/init.php');
555efc227SAndreas Gohr
66de3759aSAndreas Gohr$IMG  = getID('media');
7bfd0f597STom N Harris$ID   = cleanID($INPUT->str('id'));
8*5c2eed9aSlisps$REV    = & $INPUT->ref('rev');
9*5c2eed9aSlisps//sanitize revision
10*5c2eed9aSlisps$REV = preg_replace('/[^0-9]/', '', $REV);
1155efc227SAndreas Gohr
125381a7eeSElan Ruusamäe// this makes some general info available as well as the info about the
13b6132871SChristopher Smith// "parent" page
14b6132871SChristopher Smith$INFO = array_merge(pageinfo(),mediainfo());
15ab4d3f3bSGerrit Uitslag
16ab4d3f3bSGerrit Uitslag$tmp = array();
17ab4d3f3bSGerrit Uitslagtrigger_event('DETAIL_STARTED', $tmp);
18b6132871SChristopher Smith
19b6132871SChristopher Smith//close session
20b6132871SChristopher Smithsession_write_close();
21b6132871SChristopher Smith
22bfd0f597STom N Harrisif($conf['allowdebug'] && $INPUT->has('debug')){
2342905504SAndreas Gohr    print '<pre>';
2442905504SAndreas Gohr    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
2542905504SAndreas Gohr        print '$'."conf['$x'] = '".$conf[$x]."';\n";
2642905504SAndreas Gohr    }
2742905504SAndreas Gohr    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
2842905504SAndreas Gohr                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
2942905504SAndreas Gohr        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
3042905504SAndreas Gohr    }
3142905504SAndreas Gohr    print "getID('media'): ".getID('media')."\n";
3242905504SAndreas Gohr    print "getID('media',false): ".getID('media',false)."\n";
3342905504SAndreas Gohr    print '</pre>';
3442905504SAndreas Gohr}
3542905504SAndreas Gohr
3655efc227SAndreas Gohr$ERROR = false;
3755efc227SAndreas Gohr// check image permissions
3855efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG);
3955efc227SAndreas Gohrif($AUTH >= AUTH_READ){
4055efc227SAndreas Gohr    // check if image exists
41*5c2eed9aSlisps    $SRC = mediaFN($IMG,$REV);
42d8186216SBen Coburn    if(!@file_exists($SRC)){
4355efc227SAndreas Gohr        //doesn't exist!
449d2e1be6SAndreas Gohr        http_status(404);
450b836216SAndreas Gohr        $ERROR = 'File not found';
4655efc227SAndreas Gohr    }
4755efc227SAndreas Gohr}else{
4855efc227SAndreas Gohr    // no auth
4955efc227SAndreas Gohr    $ERROR = p_locale_xhtml('denied');
5055efc227SAndreas Gohr}
5155efc227SAndreas Gohr
5255efc227SAndreas Gohr//start output and load template
5355efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
545a892029SAndreas Gohrinclude(template('detail.php'));
5555efc227SAndreas Gohr
56