The domain of the email must be included in the poisonous source file.
[platal.git] / modules / poison.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22
23
24 class PoisonModule extends PLModule
25 {
26 function handlers()
27 {
28 return array(
29 'pe' => $this->make_hook('poison', AUTH_PUBLIC, 'user', NO_HTTPS),
30 'pem' => $this->make_hook('mailto', AUTH_PUBLIC, 'user', NO_HTTPS),
31 // 'per' => $this->make_hook('rand', AUTH_PUBLIC, 'user', NO_HTTPS),
32 );
33 }
34
35 function handler_poison(&$page, $seed = null, $count = 20)
36 {
37 $this->load('poison.inc.php');
38 if ($seed == null) {
39 $seed = time();
40 }
41 $emails = get_poison_emails($seed, $count);
42
43 foreach ($emails as $email) {
44 echo $email . "\n";
45 }
46 exit;
47 }
48
49 function handler_mailto(&$page, $seed = null, $count = 20)
50 {
51 global $globals;
52
53 $this->load('poison.inc.php');
54 if ($seed == null) {
55 $seed = time();
56 }
57 $emails = get_poison_emails($seed, $count);
58
59 echo '<html><head></head><body>';
60 foreach ($emails as $email) {
61 echo "<a href=\"mailto:$email\" >$email</a>". "\n";
62 }
63 echo '<a href="' . $globals->baseurl . '/pem/' . md5($seed) . '">suite</a></body></html>';
64 exit;
65 }
66
67 function handler_rand(&$page) {
68 $this->load('poison.inc.php');
69 randomize_poison_file();
70 exit;
71 }
72 }
73
74 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
75 ?>