1<?php 2 3/** 4 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 5 * @author Andreas Gohr <andi@splitbrain.org> 6 */ 7 8if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../'); 9define('NOSESSION', true); 10require_once(DOKU_INC . 'inc/init.php'); 11 12global $conf; 13 14// let the syntax plugin do the work 15$data = $_REQUEST; 16$plugin = plugin_load('syntax', 'graphviz'); 17$cache = $plugin->imgFile($data); 18if (!$cache) fail(); 19$time = filemtime($cache); 20 21header('Content-Type: image/svg+xml'); 22header('Expires: ' . gmdate("D, d M Y H:i:s", time() + max($conf['cachetime'], 3600)) . ' GMT'); 23header('Cache-Control: public, proxy-revalidate, no-transform, max-age=' . max($conf['cachetime'], 3600)); 24header('Pragma: public'); 25http_conditionalRequest($time); 26echo io_readFile($cache, false); 27 28 29function fail() 30{ 31 header("HTTP/1.0 404 Not Found"); 32 header('Content-Type: image/png'); 33 echo io_readFile('broken.png', false); 34 exit; 35} 36