1517bd836SAndreas Gohr<?php 2f3f6ad44SAndreas Gohr 3517bd836SAndreas Gohr/** 4517bd836SAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 5fb9a529dSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 6517bd836SAndreas Gohr */ 7517bd836SAndreas Gohr 8f3f6ad44SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../'); 9517bd836SAndreas Gohrdefine('NOSESSION', true); 10517bd836SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php'); 11517bd836SAndreas Gohr 12*e46b5f36SAndreas Gohrglobal $conf; 13*e46b5f36SAndreas Gohr 14fb9a529dSAndreas Gohr// let the syntax plugin do the work 15517bd836SAndreas Gohr$data = $_REQUEST; 16517bd836SAndreas Gohr$plugin = plugin_load('syntax', 'graphviz'); 17*e46b5f36SAndreas Gohr$cache = $plugin->imgFile($data); 18*e46b5f36SAndreas Gohrif (!$cache) fail(); 19*e46b5f36SAndreas Gohr$time = filemtime($cache); 20517bd836SAndreas Gohr 21*e46b5f36SAndreas Gohrheader('Content-Type: image/svg+xml'); 22517bd836SAndreas Gohrheader('Expires: ' . gmdate("D, d M Y H:i:s", time() + max($conf['cachetime'], 3600)) . ' GMT'); 23517bd836SAndreas Gohrheader('Cache-Control: public, proxy-revalidate, no-transform, max-age=' . max($conf['cachetime'], 3600)); 24517bd836SAndreas Gohrheader('Pragma: public'); 25517bd836SAndreas Gohrhttp_conditionalRequest($time); 26517bd836SAndreas Gohrecho io_readFile($cache, false); 27517bd836SAndreas Gohr 28fb9a529dSAndreas Gohr 29*e46b5f36SAndreas Gohrfunction fail() 30f3f6ad44SAndreas Gohr{ 31fb9a529dSAndreas Gohr header("HTTP/1.0 404 Not Found"); 32fb9a529dSAndreas Gohr header('Content-Type: image/png'); 33fb9a529dSAndreas Gohr echo io_readFile('broken.png', false); 34fb9a529dSAndreas Gohr exit; 35fb9a529dSAndreas Gohr} 36