xref: /dokuwiki/lib/exe/detail.php (revision 79e79377626799a77c11aa7849cb9c64305590c8)
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'));
84bde2196Slisps$REV  = $INPUT->int('rev');
955efc227SAndreas Gohr
105381a7eeSElan Ruusamäe// this makes some general info available as well as the info about the
11b6132871SChristopher Smith// "parent" page
12b6132871SChristopher Smith$INFO = array_merge(pageinfo(),mediainfo());
13ab4d3f3bSGerrit Uitslag
14ab4d3f3bSGerrit Uitslag$tmp = array();
15ab4d3f3bSGerrit Uitslagtrigger_event('DETAIL_STARTED', $tmp);
16b6132871SChristopher Smith
17b6132871SChristopher Smith//close session
18b6132871SChristopher Smithsession_write_close();
19b6132871SChristopher Smith
20bfd0f597STom N Harrisif($conf['allowdebug'] && $INPUT->has('debug')){
2142905504SAndreas Gohr    print '<pre>';
2242905504SAndreas Gohr    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
2342905504SAndreas Gohr        print '$'."conf['$x'] = '".$conf[$x]."';\n";
2442905504SAndreas Gohr    }
2542905504SAndreas Gohr    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
2642905504SAndreas Gohr                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
2742905504SAndreas Gohr        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
2842905504SAndreas Gohr    }
2942905504SAndreas Gohr    print "getID('media'): ".getID('media')."\n";
3042905504SAndreas Gohr    print "getID('media',false): ".getID('media',false)."\n";
3142905504SAndreas Gohr    print '</pre>';
3242905504SAndreas Gohr}
3342905504SAndreas Gohr
3455efc227SAndreas Gohr$ERROR = false;
3555efc227SAndreas Gohr// check image permissions
3655efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG);
3755efc227SAndreas Gohrif($AUTH >= AUTH_READ){
3855efc227SAndreas Gohr    // check if image exists
395c2eed9aSlisps    $SRC = mediaFN($IMG,$REV);
40*79e79377SAndreas Gohr    if(!file_exists($SRC)){
4155efc227SAndreas Gohr        //doesn't exist!
429d2e1be6SAndreas Gohr        http_status(404);
430b836216SAndreas Gohr        $ERROR = 'File not found';
4455efc227SAndreas Gohr    }
4555efc227SAndreas Gohr}else{
4655efc227SAndreas Gohr    // no auth
4755efc227SAndreas Gohr    $ERROR = p_locale_xhtml('denied');
4855efc227SAndreas Gohr}
4955efc227SAndreas Gohr
5055efc227SAndreas Gohr//start output and load template
5155efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
525a892029SAndreas Gohrinclude(template('detail.php'));
5355efc227SAndreas Gohr
54