xref: /dokuwiki/lib/exe/detail.php (revision 9d2e1be699d573eebda922cf67f030d3d2aa462d)
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');
528c7c067SAnika Henketrigger_event('DETAIL_STARTED', $tmp=array());
655efc227SAndreas Gohr//close session
755efc227SAndreas Gohrsession_write_close();
855efc227SAndreas Gohr
96de3759aSAndreas Gohr$IMG  = getID('media');
10bfd0f597STom N Harris$ID   = cleanID($INPUT->str('id'));
1155efc227SAndreas Gohr
12bfd0f597STom N Harrisif($conf['allowdebug'] && $INPUT->has('debug')){
1342905504SAndreas Gohr    print '<pre>';
1442905504SAndreas Gohr    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
1542905504SAndreas Gohr        print '$'."conf['$x'] = '".$conf[$x]."';\n";
1642905504SAndreas Gohr    }
1742905504SAndreas Gohr    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
1842905504SAndreas Gohr                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
1942905504SAndreas Gohr        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
2042905504SAndreas Gohr    }
2142905504SAndreas Gohr    print "getID('media'): ".getID('media')."\n";
2242905504SAndreas Gohr    print "getID('media',false): ".getID('media',false)."\n";
2342905504SAndreas Gohr    print '</pre>';
2442905504SAndreas Gohr}
2542905504SAndreas Gohr
2655efc227SAndreas Gohr$ERROR = false;
2755efc227SAndreas Gohr// check image permissions
2855efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG);
2955efc227SAndreas Gohrif($AUTH >= AUTH_READ){
3055efc227SAndreas Gohr    // check if image exists
3155efc227SAndreas Gohr    $SRC = mediaFN($IMG);
32d8186216SBen Coburn    if(!@file_exists($SRC)){
3355efc227SAndreas Gohr        //doesn't exist!
34*9d2e1be6SAndreas Gohr        http_status(404);
350b836216SAndreas Gohr        $ERROR = 'File not found';
3655efc227SAndreas Gohr    }
3755efc227SAndreas Gohr}else{
3855efc227SAndreas Gohr    // no auth
3955efc227SAndreas Gohr    $ERROR = p_locale_xhtml('denied');
4055efc227SAndreas Gohr}
4155efc227SAndreas Gohr
42e6e54bbfSAndreas Gohr// this makes some general infos available as well as the info about the
43e6e54bbfSAndreas Gohr// "parent" page
44e6e54bbfSAndreas Gohr$INFO = pageinfo();
45e6e54bbfSAndreas Gohr
4655efc227SAndreas Gohr//start output and load template
4755efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
485a892029SAndreas Gohrinclude(template('detail.php'));
4955efc227SAndreas Gohr
50