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//close session 655efc227SAndreas Gohrsession_write_close(); 755efc227SAndreas Gohr 86de3759aSAndreas Gohr$IMG = getID('media'); 9*bfd0f597STom N Harris$ID = cleanID($INPUT->str('id')); 1055efc227SAndreas Gohr 11*bfd0f597STom N Harrisif($conf['allowdebug'] && $INPUT->has('debug')){ 1242905504SAndreas Gohr print '<pre>'; 1342905504SAndreas Gohr foreach(explode(' ','basedir userewrite baseurl useslash') as $x){ 1442905504SAndreas Gohr print '$'."conf['$x'] = '".$conf[$x]."';\n"; 1542905504SAndreas Gohr } 1642905504SAndreas Gohr foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '. 1742905504SAndreas Gohr 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){ 1842905504SAndreas Gohr print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n"; 1942905504SAndreas Gohr } 2042905504SAndreas Gohr print "getID('media'): ".getID('media')."\n"; 2142905504SAndreas Gohr print "getID('media',false): ".getID('media',false)."\n"; 2242905504SAndreas Gohr print '</pre>'; 2342905504SAndreas Gohr} 2442905504SAndreas Gohr 2555efc227SAndreas Gohr$ERROR = false; 2655efc227SAndreas Gohr// check image permissions 2755efc227SAndreas Gohr$AUTH = auth_quickaclcheck($IMG); 2855efc227SAndreas Gohrif($AUTH >= AUTH_READ){ 2955efc227SAndreas Gohr // check if image exists 3055efc227SAndreas Gohr $SRC = mediaFN($IMG); 31d8186216SBen Coburn if(!@file_exists($SRC)){ 3255efc227SAndreas Gohr //doesn't exist! 330b836216SAndreas Gohr header("HTTP/1.0 404 File not Found"); 340b836216SAndreas Gohr $ERROR = 'File not found'; 3555efc227SAndreas Gohr } 3655efc227SAndreas Gohr}else{ 3755efc227SAndreas Gohr // no auth 3855efc227SAndreas Gohr $ERROR = p_locale_xhtml('denied'); 3955efc227SAndreas Gohr} 4055efc227SAndreas Gohr 41e6e54bbfSAndreas Gohr// this makes some general infos available as well as the info about the 42e6e54bbfSAndreas Gohr// "parent" page 43e6e54bbfSAndreas Gohr$INFO = pageinfo(); 44e6e54bbfSAndreas Gohr 4555efc227SAndreas Gohr//start output and load template 4655efc227SAndreas Gohrheader('Content-Type: text/html; charset=utf-8'); 475a892029SAndreas Gohrinclude(template('detail.php')); 4855efc227SAndreas Gohr 49