background-color: #bfb;
}
+.pem {
+ display: none;
+}
+
/* vim: set et ts=4 sts=4 sw=4: */
'geoloc', 'lists', 'marketing', 'payment', 'platal',
'profile', 'register', 'search', 'stats', 'admin',
'newsletter', 'axletter', 'bandeau', 'survey',
- 'gadgets', 'googleapps');
+ 'gadgets', 'googleapps', 'poison');
$platal->run();
exit;
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+
+
+class PoisonModule extends PLModule
+{
+ function handlers()
+ {
+ return array(
+ 'pe' => $this->make_hook('poison', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'pem' => $this->make_hook('mailto', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'per' => $this->make_hook('rand', AUTH_PUBLIC, 'user', NO_HTTPS),
+ );
+ }
+
+ function handler_poison(&$page, $seed = null, $count = 20)
+ {
+ $this->load('poison.inc.php');
+ if ($seed == null) {
+ $seed = time();
+ }
+ $emails = get_poison_emails($seed, $count);
+
+ foreach ($emails as $email) {
+ echo $email . "\n";
+ }
+ exit;
+ }
+
+ function handler_mailto(&$page, $seed = null, $count = 20)
+ {
+ global $globals;
+
+ $this->load('poison.inc.php');
+ if ($seed == null) {
+ $seed = time();
+ }
+ $emails = get_poison_emails($seed, $count);
+
+ echo '<html><head></head><body>';
+ foreach ($emails as $email) {
+ echo "<a href=\"mailto:$email\" >$email</a>". "\n";
+ }
+ echo '<a href="' . $globals->baseurl . '/pem/' . md5($seed) . '">suite</a></body></html>';
+ exit;
+ }
+
+ function handler_rand(&$page) {
+ $this->load('poison.inc.php');
+ randomize_poison_file();
+ exit;
+ }
+
+ function load($file) {
+ require_once dirname(__FILE__) . '/poison/' . $file;
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+function get_poison_emails($seed, $count)
+{
+ global $globals;
+
+ $fd = fopen($globals->poison->file, 'r');
+ $size = fstat($fd);
+ $size = $size['size'];
+ $seed = crc32($seed) % $size;
+ if ($seed < 0) {
+ $seed = $size + $seed;
+ }
+
+ fseek($fd, $seed);
+ fgets($fd);
+ $emails = array();
+ $i = 0;
+ while (!feof($fd) && $i < $count) {
+ $line = trim(fgets($fd));
+ if (strlen($line) > 0) {
+ if ($seed % 27 > 13) {
+ $line .= '@' . $globals->mail->domain;
+ } else {
+ $line .= '@' . $globals->mail->domain2;
+ }
+ $emails[] = $line;
+ ++$seed;
+ }
+ ++$i;
+ }
+ fclose($fd);
+ return $emails;
+}
+
+function randomize_poison_file()
+{
+ global $globals;
+
+ $fd = fopen($globals->poison->file, 'r');
+ $entries = array();
+ while (!feof($fd)) {
+ $line = trim(fgets($fd));
+ if (strlen($line) > 0) {
+ $entries[$line] = md5($line);
+ }
+ }
+ fclose($fd);
+
+ asort($entries);
+ $fd = fopen($globals->poison->file . '.rand', 'w');
+ foreach ($entries as $key => $value) {
+ fwrite($fd, "$key\n");
+ }
+ fclose($fd);
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+function smarty_function_poison($params, &$smarty) {
+ $count = isset($params['count']) ? $params['count'] : 20;
+ $seed = isset($params['seed']) ? $params['seed'] : date('r');
+ require_once dirname(__FILE__) . '/../modules/poison/poison.inc.php';
+
+ $emails = get_poison_emails($seed, $count);
+ $str = "";
+ foreach ($emails as $email) {
+ $str .= "<a href=\"mailto:$email\">$email</a> ";
+ }
+ return $str;
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
| <a href="stats">Statistiques</a>
{/if}
</div>
+<div class="pem">
+ <a href="{$globals->baseurl}/em/{$platal->pl_self()|replace:'/':'_'}/200">Liste1</a>
+ <a href="{$globals->baseurl}/em/{$platal->pl_self()|replace:'/':'_'}/400">Liste2</a>
+ <!--
+ {poison count=20}
+ -->
+</div>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}