xref: /dokuwiki/lib/exe/detail.php (revision d9672f6752d0f3712b36e338e1c2cb2283e4b1bc)
155efc227SAndreas Gohr<?php
2cbb44eabSAndreas Gohr
3cbb44eabSAndreas Gohruse dokuwiki\Extension\Event;
4cbb44eabSAndreas Gohr
5e3c3abf1SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
6012c7cdcSDamien 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)
9*d9672f67SAndreas Gohrglobal $INPUT, $INFO, $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
21e3c3abf1SAndreas Gohr$tmp = [];
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'));
46a46a7ce3Sasiverytpl_img_close();
47