forked from 0xABADCAFE/aoproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinclude.main.php
65 lines (53 loc) · 1.65 KB
/
include.main.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
<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Amiga.org classic browser proxy project
//
// (c) Karl Churchill 2010
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// bounce anything that doesn't appear to be amigoid or linux/mac
if (!preg_match('@amiga|morphos|aros|linux|android@i', $_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://amiga.org/' . $_SERVER['REQUEST_URI']);
die();
}
// enable output buffering and turn on gz compression module. Since we are only sending PHP via the proxy, this is
// sufficient, we don't need to consider apache's mod_compression
if (!ob_start("ob_gzhandler")) {
ob_start();
}
error_reporting(E_ALL|E_STRICT);
//session_start();
require_once('config.php');
require_once('classes.misc.php');
require_once('classes.curl.php');
require_once('classes.markuprewriter.php');
require_once('classes.pagerequest.php');
Session::init();
// add the default rewriters
class HeadIFrameEliminator implements MarkupRewriter {
public function process($content) {
return preg_replace(
array(
'@^<iframe.*?>\s+</iframe>@',
'@http://amiga.org/forums/search.php@'
),
array(
'',
'http://aoproxy.extropia.co.uk/forums/search.php'
),
$content
);
}
}
PageRequest::getInstance()->addRewriters(
array(
new HeadIFrameEliminator(),
new DegradeXHTMLRewriter(),
new LinkRewriter(),
new MainNavigationRewriter(),
new CommonBlockRewriter(),
new CSSRewriter(),
new JavascriptRewriter()
)
);