[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/exe/ -> detail.php (source)

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