Code : Tout sélectionner
$texte= preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<img src=\"email2png.php?domaine=\\3&nom=\\2\" alt='E-mail'>", $texte);
Code : Tout sélectionner
<?php
/***************************************************************************
* email2png.php
* -------------------
* begin : Wed, June 8, 2005
*
***************************************************************************/
if (isset($_GET["nom"])) $nom = $_GET["nom"];
else $nom = "nobody";
if (isset($_GET["domaine"])) $domaine = $_GET["domaine"];
else $domaine = "team-azerty.com";
$texte = $nom."@".$domaine;
$im = imagecreate(strlen($texte)*9, 16);
// fond blanc et texte bleu
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 0);
// ajout de la phrase en haut à gauche
imagestring($im, 5, 0, 0, $texte, $textcolor);
// affichage de l'image
header("Content-type: image/png");
imagepng($im);
?>
Code : Tout sélectionner
## easymod compliant
##############################################################
## MOD Title: Hide Email
## MOD Author: W. Aurélien http://www.team-azerty.com
## MOD Description: This mod replace e-mail addresses in post to spam-bots and anonymous users with Image.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 1 Minute
## Files To Edit: /viewtopic.php, /includes/bbcode.php
## Included Files: email2png.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: This mod was tested on phpBB version 2.0.15
##
##############################################################
## MOD History:
##
## 2005-06-08 - Version 1.0.0
## - Initial version. Hides e-mail in post message.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#--[ COPY ]
#
copy email2png.php to includes/email2png.php
#
#-----[ OPEN ]------------------------------------------
#
/includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
function make_clickable($text)
#
#-----[ REPLACE WITH ]------------------------------------------
#
function make_clickable($text, $viewEmail=true)
#
#-----[ FIND ]------------------------------------------
#
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ($viewEmail) $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
else $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<img src=\"./includes/email2png.php?domaine=\\3&nom=\\2\" alt='E-mail'>", $ret);
#
#-----[ OPEN ]------------------------------------------
#
/viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$message = make_clickable($message);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$message = make_clickable($message, ( !empty($userdata['user_id']) && ($userdata['user_id'] != ANONYMOUS) ));
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM