xref: /dokuwiki/lib/exe/detail.php (revision 012c7cdc1eaa60ee12aedc0a77226245a4e8e121)
155efc227SAndreas Gohr<?php
2cbb44eabSAndreas Gohr
3cbb44eabSAndreas Gohruse dokuwiki\Extension\Event;
4cbb44eabSAndreas Gohr
5d0a27cb0SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
6*012c7cdcSDamien Regadif(!defined('DOKU_MEDIADETAIL')) define('DOKU_MEDIADETAIL',1);
71eadd9e8SAndreas Gohr
81eadd9e8SAndreas Gohr// define all DokuWiki globals here (needed within test requests but also helps to keep track)
91eadd9e8SAndreas Gohrglobal $INPUT, $IMG, $ID, $REV, $SRC, $ERROR, $AUTH;
101eadd9e8SAndreas Gohr
1155efc227SAndreas Gohrrequire_once(DOKU_INC.'inc/init.php');
1255efc227SAndreas Gohr
136de3759aSAndreas Gohr$IMG  = getID('media');
14bfd0f597STom N Harris$ID   = cleanID($INPUT->str('id'));
154bde2196Slisps$REV  = $INPUT->int('rev');
1655efc227SAndreas Gohr
175381a7eeSElan Ruusamäe// this makes some general info available as well as the info about the
18b6132871SChristopher Smith// "parent" page
19b6132871SChristopher Smith$INFO = array_merge(pageinfo(),mediainfo());
20ab4d3f3bSGerrit Uitslag
21ab4d3f3bSGerrit Uitslag$tmp = array();
22cbb44eabSAndreas GohrEvent::createAndTrigger('DETAIL_STARTED', $tmp);
23b6132871SChristopher Smith
24b6132871SChristopher Smith//close session
25b6132871SChristopher Smithsession_write_close();
26b6132871SChristopher Smith
2755efc227SAndreas Gohr$ERROR = false;
2855efc227SAndreas Gohr// check image permissions
2955efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG);
3055efc227SAndreas Gohrif($AUTH >= AUTH_READ){
3155efc227SAndreas Gohr    // check if image exists
325c2eed9aSlisps    $SRC = mediaFN($IMG,$REV);
3379e79377SAndreas Gohr    if(!file_exists($SRC)){
3455efc227SAndreas Gohr        //doesn't exist!
359d2e1be6SAndreas Gohr        http_status(404);
360b836216SAndreas Gohr        $ERROR = 'File not found';
3755efc227SAndreas Gohr    }
3855efc227SAndreas Gohr}else{
3955efc227SAndreas Gohr    // no auth
4055efc227SAndreas Gohr    $ERROR = p_locale_xhtml('denied');
4155efc227SAndreas Gohr}
4255efc227SAndreas Gohr
4355efc227SAndreas Gohr//start output and load template
4455efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
455a892029SAndreas Gohrinclude(template('detail.php'));
4655efc227SAndreas Gohr
47