Example #1
0
    function cloack_email($mail_address) {
        $cfg=BidsHelperTools::getConfig();

        if ($cfg->bid_opt_enable_antispam_bot) {
            if ($cfg->bid_opt_choose_antispam_bot == "recaptcha") {
                require(JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'recaptcha' . DS . 'recaptchalib.php');
                $mail = recaptcha_mailhide_url("01WxCXdKklKdG2JpOlMY15jw==", "2198178B23BFFB00CBAEA6370CE7A0B2", $mail_address);
                return "<a href=\"$mail.\" onclick=\"window.open('$mail', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0, menubar=0,resizable=0,width=500,height=300');	return false;\" title=\"Reveal this e-mail address\">" . JText::_("COM_BIDS_SHOW_EMAIL") . "</a>";
            } elseif ($cfg->bid_opt_choose_antispam_bot == "joomla") {

                // Discutable if use Content Mail Plugin or ... just JHTML_('email.cloac' it does the same .. just global configuration is in question
                $plugin = JPluginHelper::getPlugin('content', 'emailcloak');
                $pluginParams = new JParameter($plugin->params);
                require_once (JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'emailcloak.php');
                plgContentEmailCloak($mail_address, $pluginParams);
                return $mail_address;
            } elseif ($cfg->bid_opt_choose_antispam_bot == "smarty") {
                $smarty = new JTheFactorySmarty();
                require_once(SMARTY_DIR . "plugins/function.mailto.php");
                return BidsSmarty::smarty_rbids_print_encoded(array("address" => $mail_address, "encode" => "hex"), $smarty);
            }
        } else {
            return $mail_address;
        }
    }
Example #2
0
 function replace_plaintext($matches)
 {
     if ($this->options['replace_link_with'] == "" && $this->options['replace_title_with'] == "") {
         // find plain text emails and hide them
         $html = recaptcha_mailhide_html($this->options['public_key'], $this->options['private_key'], $matches[0]);
     } else {
         // replace both things
         if ($this->options['replace_link_with'] != "" && $this->options['replace_title_with'] != "") {
             $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
             $html = "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"" . $this->options['replace_title_with'] . "\">" . $this->options['replace_link_with'] . "</a>";
         } else {
             if ($this->options['replace_link_with'] != "" && $this->options['replace_title_with'] == "") {
                 $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
                 $html = "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">" . $this->options['replace_link_with'] . "</a>";
             } else {
                 if ($this->options['replace_link_with'] == "" && $this->options['replace_title_with'] != "") {
                     $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
                     $emailparts = _recaptcha_mailhide_email_parts($matches[0]);
                     $html = htmlentities($emailparts[0], ENT_QUOTES) . "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"" . $recaptcha_opt['replace_title_with'] . "\">...</a>@" . htmlentities($emailparts[0], ENT_QUOTES);
                 }
             }
         }
     }
     // style it
     $html = '<span class="mh-email">' . $html . "</span>";
     return $html;
 }
Example #3
0
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://www.google.com/recaptcha/mailhide/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]);
}
Example #4
0
<html><body>
<?php 
require_once "recaptchalib.php";
// get a key at http://www.google.com/recaptcha/mailhide/apikey
$mailhide_pubkey = '';
$mailhide_privkey = '';
?>

The Mailhide version of example@example.com is
<?php 
echo recaptcha_mailhide_html($mailhide_pubkey, $mailhide_privkey, "*****@*****.**");
?>
. <br>

The url for the email is:
<?php 
echo recaptcha_mailhide_url($mailhide_pubkey, $mailhide_privkey, "*****@*****.**");
?>
 <br>

</body></html>
Example #5
0
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://www.google.com/recaptcha/mailhide/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
        return "To use reCAPTCHA Mailhide, you have to sign up for a public and private key, you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>";
    }
    if (!function_exists("mcrypt_encrypt")) {
        return "To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.";
    }
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]);
}
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://mailhide.recaptcha.net/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email, $html) {
	
	// pro memoria : $html = array($id, $title, $target, $classification, $hreflang, $content);
	if(strlen($html[0]) > 0) 
	{
		$id = $html[0];
	}
	$title = 'Reveal this e-mail address';
	if(strlen($html[1]) > 0) 
	{
		$title = $html[1];
	}
		
	if(strlen($html[2]) > 0) 
	{
		$target = $html[2];
	}
	
	if(strlen($html[3]) > 0) 
	{
		$cssclass = $html[3];
	}
	
	if(strlen($html[4]) > 0) 
	{
		$hreflang = $html[4];
	}
	
	if(strlen($html[5]) > 0) 
	{
		$content = $html[5];
	}		

	$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
	
	if( !filter_var($content, FILTER_VALIDATE_EMAIL)) // using php >= 5.2, makes sure it's not an email 
	{		
		$parts[0] = $content; // raw link label from content text
		$html = '';
	} 
	else 
	{
		$parts = _recaptcha_mailhide_email_parts ($email);
		$html = htmlentities($parts[0]);
	}	
	
	$html .= "<a ";
	if(isset($id))
	{
		$html .= "id='" . $id . "' "; 
	}
	if(isset($cssclass))
	{
		$html .= "class='" . $cssclass . "' "; 
	}
	if(isset($target))
	{
		$html .= "target='" . $target . "' "; 
	}
	if(isset($hreflang))
	{
		$html .= "hreflang='" . $hreflang . "' ";
	}
	$html .= "href='" . htmlentities ($url). "' ";
	$html .= "onclick=\"window.open('" . htmlentities ($url) . "', '', ";
	$html .= "'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" ";
	
	// if link label is an email
	if(count($parts) > 1)
	{
		$html .= "title=\"" . $title . "\">...</a>";
		$html .= '@' . htmlentities ($parts[1]);
	}
	else 
	{
		$html .= "title=\"" . $title . "\">". $parts[0] . "</a>"; // raw link label from content text 	
	}
	return $html;

}
Example #7
0
<?php
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://mailhide.recaptcha.net/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . '<a href="' . htmlentities($url) . '" onclick="window.open("' . htmlentities($url) . '", "", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300"); return false;" title="Reveal this e-mail address">...</a>@' . htmlentities($emailparts[1]);
}
 /**
  * Gets the url for an hidden email.
  *
  * This method will only return a url. If you want to create a link, you
  *  should use the `mailLink()` method
  * @param string $mail Email to hide
  * @return string Url
  * @throws InternalErrorException
  */
 public function mailUrl($mail)
 {
     //Gets mail keys
     $keys = Configure::read('Recaptcha.Mail');
     //Checks for mail keys
     if (empty($keys['public']) || empty($keys['private'])) {
         throw new InternalErrorException(__d('me_tools', 'Mail keys are not configured'));
     }
     //Checks if the private mail key is valid (hexadecimal digits)
     if (!ctype_xdigit($keys['private'])) {
         throw new InternalErrorException(__d('me_tools', 'The private mail key is not valid'));
     }
     return recaptcha_mailhide_url($keys['public'], $keys['private'], $mail);
 }
Example #10
0
function email_obfuscate($address, $link_text = null, $pre_text = '', $post_text = '')
{
    if (is_null($link_text)) {
        $link_text = $address;
    }
    return $pre_text . "<a href='mailto:{$address}'>{$link_text}</a>" . $post_text;
    $address = strtolower($address);
    $coded = "";
    $unmixedkey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@";
    $len = strlen($unmixedkey);
    for ($i = 0; $i < $len; $i++) {
        $unmixedkey .= $unmixedkey[rand(0, $len - 1)];
    }
    $cipher = substr($unmixedkey, $len, 2 * $len);
    $shift = strlen($address);
    $txt = "<script type=\"text/javascript\">\n" . "          <!-" . "-\n" . "          // Email obfuscator script 2.1 by Tim Williams, University of Arizona\n" . "          // Random encryption key feature by Andrew Moulden, Site Engineering Ltd\n" . "          // PHP version coded by Ross Killen, Celtic Productions Ltd\n" . "          // This code is freeware provided these six comment lines remain intact\n" . "          // A wizard to generate this code is at http://www.jottings.com/obfuscator/\n" . "          // The PHP code may be obtained from http://www.celticproductions.net/\n\n";
    for ($j = 0; $j < strlen($address); $j++) {
        if (strpos($cipher, $address[$j]) == -1) {
            $chr = $address[$j];
            $coded .= $address[$j];
        } else {
            $chr = (strpos($cipher, $address[$j]) + $shift) % strlen($cipher);
            $coded .= $cipher[$chr];
        }
    }
    if (is_null($link_text)) {
        $js_link_text = '"+link+"';
        $ns_link_text = 'this address';
    } else {
        $js_link_text = $link_text;
        $ns_link_text = $link_text;
    }
    global $MAILHIDE_PUBLIC_KEY, $MAILHIDE_PRIVATE_KEY;
    $mailhide_url = htmlentities(recaptcha_mailhide_url($MAILHIDE_PUBLIC_KEY, $MAILHIDE_PRIVATE_KEY, $address));
    $escaped_pre_text = str_replace('"', '\\"', $pre_text);
    $escaped_post_text = str_replace('"', '\\"', $post_text);
    $txt .= "          coded = \"" . $coded . "\"\n" . "            key = \"" . $cipher . "\"\n" . "            shift=coded.length\n" . "            link=\"\"\n" . "            for (i=0; i<coded.length; i++) {\n" . "              if (key.indexOf(coded.charAt(i))==-1) {\n" . "                ltr = coded.charAt(i)\n" . "                link += (ltr)\n" . "              }\n" . "              else {     \n" . "                ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length\n" . "                link += (key.charAt(ltr))\n" . "              }\n" . "            }\n" . "          document.write(\"<div>{$escaped_pre_text}<a href='mailto:\"+link+\"' target='_blank'>{$js_link_text}</a>{$escaped_post_text}</div>\")\n" . "          \n" . "          //-" . "->\n" . "          <" . "/script>\n          <noscript><div>{$pre_text}<a href=\"{$mailhide_url}\" onclick=\"window.open('{$mailhide_url}', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">" . $ns_link_text . '</a>' . "{$post_text}</div></noscript>";
    return $txt;
}
<html><body>
<?
require_once ("recaptchalib.php");

// get a key at http://www.google.com/recaptcha/mailhide/apikey
$mailhide_pubkey = '';
$mailhide_privkey = '';

?>

The Mailhide version of allan.masamune@gmail.com is
<? echo recaptcha_mailhide_html ($mailhide_pubkey, $mailhide_privkey, "*****@*****.**"); ?>. <br>

The url for the email is:
<? echo recaptcha_mailhide_url ($mailhide_pubkey, $mailhide_privkey, "*****@*****.**"); ?> <br>
allan.masamune
gmailbody></html>