1<?php
2/**
3 * @license    GPL 3 (http://www.gnu.org/licenses/gpl-3.0.html)
4 * @author     Yann Pouillon <yann.pouillon@materialsevolution.es>
5 */
6
7if ( !defined('DOKU_INC') ) {
8  define('DOKU_INC', dirname(__FILE__).'/../../../');
9}
10define('NOSESSION',true);
11require_once(DOKU_INC.'inc/init.php');
12
13// Let the syntax plugin do the work
14$data = $_REQUEST;
15$plugin = plugin_load('syntax', 'dataplot');
16$cache  = $plugin->_imgfile($data);
17if(!$cache) _fail();
18
19header('Content-Type: image/png;');
20header('Expires: '.gmdate("D, d M Y H:i:s", time()+max($conf['cachetime'], 3600)).' GMT');
21header('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($conf['cachetime'], 3600));
22header('Pragma: public');
23http_conditionalRequest($time);
24echo io_readFile($cache, false);
25
26function _fail() {
27  header("HTTP/1.0 404 Not Found");
28  header('Content-Type: image/png');
29  echo io_readFile('error.png', false);
30  exit;
31}
32