detail.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use dokuwiki\Extension\Event;
  3. if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
  4. if(!defined('DOKU_MEDIADETAIL')) define('DOKU_MEDIADETAIL',1);
  5. // define all DokuWiki globals here (needed within test requests but also helps to keep track)
  6. global $INPUT, $IMG, $ID, $REV, $SRC, $ERROR, $AUTH;
  7. require_once(DOKU_INC.'inc/init.php');
  8. $IMG = getID('media');
  9. $ID = cleanID($INPUT->str('id'));
  10. $REV = $INPUT->int('rev');
  11. // this makes some general info available as well as the info about the
  12. // "parent" page
  13. $INFO = array_merge(pageinfo(),mediainfo());
  14. $tmp = array();
  15. Event::createAndTrigger('DETAIL_STARTED', $tmp);
  16. //close session
  17. session_write_close();
  18. $ERROR = false;
  19. // check image permissions
  20. $AUTH = auth_quickaclcheck($IMG);
  21. if($AUTH >= AUTH_READ){
  22. // check if image exists
  23. $SRC = mediaFN($IMG,$REV);
  24. if(!file_exists($SRC)){
  25. //doesn't exist!
  26. http_status(404);
  27. $ERROR = 'File not found';
  28. }
  29. }else{
  30. // no auth
  31. $ERROR = p_locale_xhtml('denied');
  32. }
  33. //start output and load template
  34. header('Content-Type: text/html; charset=utf-8');
  35. include(template('detail.php'));
  36. tpl_img_close();