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