xref: /dokuwiki/lib/exe/detail.php (revision b613287149ac4707ec40a96b1b6fe8b190fa6439)
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'));
855efc227SAndreas Gohr
9*b6132871SChristopher Smith// this makes some general infos available as well as the info about the
10*b6132871SChristopher Smith// "parent" page
11*b6132871SChristopher Smith$INFO = array_merge(pageinfo(),mediainfo());
12*b6132871SChristopher Smithtrigger_event('DETAIL_STARTED', $tmp=array());
13*b6132871SChristopher Smith
14*b6132871SChristopher Smith//close session
15*b6132871SChristopher Smithsession_write_close();
16*b6132871SChristopher Smith
17bfd0f597STom N Harrisif($conf['allowdebug'] && $INPUT->has('debug')){
1842905504SAndreas Gohr    print '<pre>';
1942905504SAndreas Gohr    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
2042905504SAndreas Gohr        print '$'."conf['$x'] = '".$conf[$x]."';\n";
2142905504SAndreas Gohr    }
2242905504SAndreas Gohr    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
2342905504SAndreas Gohr                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
2442905504SAndreas Gohr        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
2542905504SAndreas Gohr    }
2642905504SAndreas Gohr    print "getID('media'): ".getID('media')."\n";
2742905504SAndreas Gohr    print "getID('media',false): ".getID('media',false)."\n";
2842905504SAndreas Gohr    print '</pre>';
2942905504SAndreas Gohr}
3042905504SAndreas Gohr
3155efc227SAndreas Gohr$ERROR = false;
3255efc227SAndreas Gohr// check image permissions
3355efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG);
3455efc227SAndreas Gohrif($AUTH >= AUTH_READ){
3555efc227SAndreas Gohr    // check if image exists
3655efc227SAndreas Gohr    $SRC = mediaFN($IMG);
37d8186216SBen Coburn    if(!@file_exists($SRC)){
3855efc227SAndreas Gohr        //doesn't exist!
399d2e1be6SAndreas Gohr        http_status(404);
400b836216SAndreas Gohr        $ERROR = 'File not found';
4155efc227SAndreas Gohr    }
4255efc227SAndreas Gohr}else{
4355efc227SAndreas Gohr    // no auth
4455efc227SAndreas Gohr    $ERROR = p_locale_xhtml('denied');
4555efc227SAndreas Gohr}
4655efc227SAndreas Gohr
4755efc227SAndreas Gohr//start output and load template
4855efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
495a892029SAndreas Gohrinclude(template('detail.php'));
5055efc227SAndreas Gohr
51