0byt3m1n1
Path:
/
data
/
applications
/
aps
/
tikiwiki
/
14.1-0
/
standard
/
htdocs
/
lib
/
userprefs
/
[
Home
]
File: scrambleEmail.php
<?php // (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: scrambleEmail.php 53803 2015-02-06 00:42:50Z jyhem $ /** * scramble an email with a method * @param string email emil to be scrambled * @param string method=unicode or y: each character is replaced with the unicode value * @param string method=strtr: mr@tw.org -> mr AT tw DOT org * @param string method=x: mr@tw.org -> mr@xxxxxx * @return string scrambled email */ //this script may only be included - so its better to die if called directly. if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { header("location: index.php"); exit; } /** * @param $email * @param string $method * @return string */ function scrambleEmail($email, $method='unicode') { switch ($method) { case 'strtr': $trans = array( "@" => tra("(AT)"), "." => tra("(DOT)") ); return strtr($email, $trans); case 'x' : $encoded = $email; for ($i = strpos($email, "@") + 1, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) { if ($encoded[$i] != ".") $encoded[$i] = 'x'; } return $encoded; case 'unicode': case 'y':// for previous compatibility $encoded = ''; for ($i = 0, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) { $encoded .= '&#' . ord($email[$i]). ';'; } return $encoded; case 'n': default: return $email; } }