xref: /plugin/graphviz/img.php (revision 9d954370cc99a7ad567bfa05ad196b85cc4fda55)
1517bd836SAndreas Gohr<?php
2517bd836SAndreas Gohr/**
3517bd836SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4517bd836SAndreas Gohr * @author     Andreas Gohr <gohr@cosmocode.de>
5517bd836SAndreas Gohr */
6517bd836SAndreas Gohr
7517bd836SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
8517bd836SAndreas Gohrdefine('NOSESSION',true);
9517bd836SAndreas Gohrrequire_once(DOKU_INC.'inc/init.php');
10517bd836SAndreas Gohrrequire_once(DOKU_INC.'inc/pageutils.php');
11517bd836SAndreas Gohrrequire_once(DOKU_INC.'inc/httputils.php');
12517bd836SAndreas Gohrrequire_once(DOKU_INC.'inc/io.php');
13517bd836SAndreas Gohr
14*9d954370SAndreas Gohr// let the plugin do the work
15517bd836SAndreas Gohr$data = $_REQUEST;
16517bd836SAndreas Gohr$plugin = plugin_load('syntax','graphviz');
17*9d954370SAndreas Gohr$cache  = $plugin->_imgfile($data);
18517bd836SAndreas Gohr
19517bd836SAndreas Gohr
20517bd836SAndreas Gohr// something went wrong, we're missing the file
21517bd836SAndreas Gohrif(!file_exists($cache)){
22517bd836SAndreas Gohr    header("HTTP/1.0 404 Not Found");
23517bd836SAndreas Gohr    header('Content-Type: image/png');
24517bd836SAndreas Gohr    echo io_readFile('broken.png',false);
25517bd836SAndreas Gohr    exit;
26517bd836SAndreas Gohr}
27517bd836SAndreas Gohr
28517bd836SAndreas Gohrheader('Content-Type: image/png;');
29517bd836SAndreas Gohrheader('Expires: '.gmdate("D, d M Y H:i:s", time()+max($conf['cachetime'], 3600)).' GMT');
30517bd836SAndreas Gohrheader('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($conf['cachetime'], 3600));
31517bd836SAndreas Gohrheader('Pragma: public');
32517bd836SAndreas Gohrhttp_conditionalRequest($time);
33517bd836SAndreas Gohrecho io_readFile($cache,false);
34517bd836SAndreas Gohr
35517bd836SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 :
36