-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
73 lines (61 loc) · 1.71 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/*
*
* P R E D I S P A T C H E R
*
*
* This is free software and Open Source
* GNU General Public License (GNU GPL) version 3
*
* Author: Axel Hahn
*
* The preDispatcher is a cache in front of a slow website delivery/ cms.
* Initially it was created for my website with Concrete5. But it could
* be used for other products too.
*
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once('classes/pre_dispatcher.class.php');
// ======================================================================
//
// FUNCTIONS
//
// ======================================================================
function handleOutput($buffer){
global $oAhd;
$aCustomHeaders=array(
// 'variable'=>'value',
);
$oAhd->doCache(array(
'url'=>$oAhd->getRefreshUrl(),
'header_orig'=>apache_response_headers(),
'setheaders'=>$aCustomHeaders,
'content'=>$buffer,
));
$oAhd->renderCustomHeaders($aCustomHeaders);
$buffer=str_replace(
'</body',
$oAhd->renderHeaders().'</body',
$buffer
);
return $buffer;
}
// ======================================================================
//
// MAIN
//
// ======================================================================
global $oAhd;
$oAhd=new preDispatcher();
$oAhd->getCachedContent();
// ----------------------------------------------------------------------
// no cache? --> run normal request
// ----------------------------------------------------------------------
$oAhd->removeDispatcherParams();
$oAhd->addInfo('--> making a request');
ob_start("handleOutput", 0, false);
require __DIR__.'/../../concrete/dispatcher.php';
ob_end_flush();
die();