-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailman.php
92 lines (67 loc) · 2.17 KB
/
mailman.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
include "bits/snoopy.inc";
$fetcher = new Snoopy;
$my_url = "/tp/mailman.php";
$real_short = "/cgi-bin/mailman";
$real_host = "mail.thousandparsec.net";
$my_host = $_SERVER['SERVER_NAME'];
$real_real = "http://$real_host$real_short";
$real_url = "http://$my_host$real_short";
// Include GET stuff
$url = $_SERVER['REQUEST_URI'];
$url = $real_real . str_replace($my_url, '', $url);
// Include COOKIES stuff
foreach ($_COOKIE as $key => $value) {
$key = str_replace('_', '+', $key);
$fetcher->cookies[$key] = $value;
}
// Include POST
$sfrom = array(".", "+" );
$sto = array("#DOT#", "#PLUS#");
$post = array();
foreach ($_POST as $key => $value) {
$post[] = array(str_replace($sto, $sfrom, /*substr(*/$key/*,5)*/) => $value);
}
$fetcher->set_submit_multipart();
$fetcher->submit($url,$post);
$data = $fetcher->results;
// Rewrite any cookies
foreach ($fetcher->headers as $key => $value) {
if (substr($value, 0, 11) == "Set-Cookie:") {
header ( str_replace($real_short, $my_url, $value) );
}
}
?>
<!-- <?php echo $url; echo $real_url; ?> -->
<?php $title = "Lists" ?>
<?php include "bits/start_page.inc" ?>
<?php include "bits/start_section.inc" ?>
<?php
$data = str_replace($real_url, $my_url, $data);
$data = str_replace($real_short, $my_url, $data);
$real_colors = array('#dddddd', '#99ccff', '#FFF0D0', '#99CCFF');
$my_colors = array('#444444', '#003355', '#666666', '#003355');
$data = str_replace($real_colors, $my_colors, $data);
// Remove headers
$data = preg_replace(":<HTML>(.*\n)*\s*<BODY.*>:i", "", $data);
$data = preg_replace(":</BODY>\n</HTML>\n:i", "", $data);
preg_match_all ('/ name=(.+?) /i', $data, $matches);
$i = 0;
$prev = "";
foreach ($matches[1] as $key => $value) {
if ($prev == $value)
$i -= 1;
else
$prev = $value;
$from = '/name=' . $value . '/i';
$to = 'name="' . /*sprintf("%05d", $i) .*/ str_replace($sfrom, $sto, str_replace('"', '', $value)) . '"';
$data = preg_replace($from, $to, $data, 1);
$i += 1;
}
// Archives stuff
$data = str_replace("/pipermail", "/tp/pipermail.php", $data);
$data = str_replace($real_host, $my_host, $data);
echo $data;
?>
<?php include "bits/end_section.inc" ?>
<?php include "bits/end_page.inc" ?>