1<?php 2if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); 3define('DOKU_MEDIADETAIL',1); 4require_once(DOKU_INC.'inc/init.php'); 5 6$IMG = getID('media'); 7$ID = cleanID($INPUT->str('id')); 8$REV = & $INPUT->ref('rev'); 9//sanitize revision 10$REV = preg_replace('/[^0-9]/', '', $REV); 11 12// this makes some general info available as well as the info about the 13// "parent" page 14$INFO = array_merge(pageinfo(),mediainfo()); 15 16$tmp = array(); 17trigger_event('DETAIL_STARTED', $tmp); 18 19//close session 20session_write_close(); 21 22if($conf['allowdebug'] && $INPUT->has('debug')){ 23 print '<pre>'; 24 foreach(explode(' ','basedir userewrite baseurl useslash') as $x){ 25 print '$'."conf['$x'] = '".$conf[$x]."';\n"; 26 } 27 foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '. 28 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){ 29 print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n"; 30 } 31 print "getID('media'): ".getID('media')."\n"; 32 print "getID('media',false): ".getID('media',false)."\n"; 33 print '</pre>'; 34} 35 36$ERROR = false; 37// check image permissions 38$AUTH = auth_quickaclcheck($IMG); 39if($AUTH >= AUTH_READ){ 40 // check if image exists 41 $SRC = mediaFN($IMG,$REV); 42 if(!@file_exists($SRC)){ 43 //doesn't exist! 44 http_status(404); 45 $ERROR = 'File not found'; 46 } 47}else{ 48 // no auth 49 $ERROR = p_locale_xhtml('denied'); 50} 51 52//start output and load template 53header('Content-Type: text/html; charset=utf-8'); 54include(template('detail.php')); 55 56