Esempio n. 1
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;
 }
Esempio n. 2
0
 /**
  * 
  * @param string $email_address
  * @return string HTML email address
  */
 public static function showEmail($email_address)
 {
     return recaptcha_mailhide_html(self::$mailhide_public_key, self::$mailhide_private_key, $email_address);
 }
<?php

use_helper('recaptcha');
?>

<?php 
echo recaptcha_mailhide_html(sfConfig::get('app_mailhide_publickey'), sfConfig::get('app_mailhide_privatekey'), '*****@*****.**');
Esempio n. 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>
	function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters )
	{
		$return = '';

		switch ( $operatorName )
		{
			case 'mailhide':
				{
					$ini = eZINI::instance();
					$keys = $ini->variable( 'MailHideSettings', 'Keys' );									

					$email = (isset($namedParameters['href']) ? trim($namedParameters['href']) : '*****@*****.**');
					$email = ((substr($email,0,7) === 'mailto:') ? str_replace('mailto:','',$email) : $email);
					
					$id = (isset($namedParameters['id']) ? trim($namedParameters['id']) : '');
					$title = (isset($namedParameters['title']) ? trim($namedParameters['title']) : '');
					$target = (isset($namedParameters['target']) ? trim($namedParameters['target']) : '');
					$classification = (isset($namedParameters['classification']) ? trim($namedParameters['classification']) : '');
					$hreflang = (isset($namedParameters['hreflang']) ? trim($namedParameters['hreflang']) : '');
					$content = (isset($namedParameters['content']) ? trim($namedParameters['content']) : '');
					$html = array($id, $title, $target, $classification, $hreflang, $content);					
					
					$return = recaptcha_mailhide_html ($keys['Public'], $keys['Private'], $email, $html);
				} break;
		}
		$operatorValue = $return;
	}
Esempio n. 6
0
<?php

// Include common.php w/ Smarty
define('USING_SMARTY', true);
require 'common.php';
require $config['paths']['includes'] . 'recaptcha/recaptchalib.php';
// Set the page title
$page['title'] = 'Terms Of Service';
if (strlen($config['recaptchamailhide']['publickey']) > 0 && strlen($config['recaptchamailhide']['privatekey']) > 0) {
    $data['mailhide'] = recaptcha_mailhide_html($config['recaptchamailhide']['publickey'], $config['recaptchamailhide']['privatekey'], $config['mail']['takedown']);
}
// Render the page
$tpl->display('header.tpl');
$tpl->display('tos.tpl');
$tpl->display('footer.tpl');
Esempio n. 7
0
 /**
  * executes & returns or displays the template results
  *
  * @param string $resource_name
  * @param string $cache_id
  * @param string $compile_id
  * @param boolean $display
  */
 function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
 {
     static $_cache_info = array();
     $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) ? $this->error_reporting : error_reporting() & ~E_NOTICE);
     if (!$this->debugging && $this->debugging_ctrl == 'URL') {
         $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
         if (@strstr($_query_string, $this->_smarty_debug_id)) {
             if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
                 // enable debugging for this browser session
                 @setcookie('SMARTY_DEBUG', true);
                 $this->debugging = true;
             } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
                 // disable debugging for this browser session
                 @setcookie('SMARTY_DEBUG', false);
                 $this->debugging = false;
             } else {
                 // enable debugging for this page
                 $this->debugging = true;
             }
         } else {
             $this->debugging = (bool) ($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
         }
     }
     if ($this->debugging) {
         // capture time for debugging info
         $_params = array();
         require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
         $_debug_start_time = smarty_core_get_microtime($_params, $this);
         $this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $resource_name, 'depth' => 0);
         $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
     }
     if (!isset($compile_id)) {
         $compile_id = $this->compile_id;
     }
     $this->_compile_id = $compile_id;
     $this->_inclusion_depth = 0;
     if ($this->caching) {
         // save old cache_info, initialize cache_info
         array_push($_cache_info, $this->_cache_info);
         $this->_cache_info = array();
         $_params = array('tpl_file' => $resource_name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, 'results' => null);
         require_once SMARTY_CORE_DIR . 'core.read_cache_file.php';
         if (smarty_core_read_cache_file($_params, $this)) {
             $_smarty_results = $_params['results'];
             if (!empty($this->_cache_info['insert_tags'])) {
                 $_params = array('plugins' => $this->_cache_info['insert_tags']);
                 require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
                 smarty_core_load_plugins($_params, $this);
                 $_params = array('results' => $_smarty_results);
                 require_once SMARTY_CORE_DIR . 'core.process_cached_inserts.php';
                 $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
             }
             if (!empty($this->_cache_info['cache_serials'])) {
                 $_params = array('results' => $_smarty_results);
                 require_once SMARTY_CORE_DIR . 'core.process_compiled_include.php';
                 $_smarty_results = smarty_core_process_compiled_include($_params, $this);
             }
             if ($display) {
                 if ($this->debugging) {
                     // capture time for debugging info
                     $_params = array();
                     require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
                     $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
                     require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
                     $_smarty_results .= smarty_core_display_debug_console($_params, $this);
                 }
                 if ($this->cache_modified_check) {
                     $_server_vars = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
                     $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
                     $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']) . ' GMT';
                     if (@count($this->_cache_info['insert_tags']) == 0 && !$this->_cache_serials && $_gmt_mtime == $_last_modified_date) {
                         if (php_sapi_name() == 'cgi') {
                             header('Status: 304 Not Modified');
                         } else {
                             header('HTTP/1.1 304 Not Modified');
                         }
                     } else {
                         header('Last-Modified: ' . $_gmt_mtime);
                         echo $_smarty_results;
                     }
                 } else {
                     echo $_smarty_results;
                 }
                 error_reporting($_smarty_old_error_level);
                 // restore initial cache_info
                 $this->_cache_info = array_pop($_cache_info);
                 return true;
             } else {
                 error_reporting($_smarty_old_error_level);
                 // restore initial cache_info
                 $this->_cache_info = array_pop($_cache_info);
                 return $_smarty_results;
             }
         } else {
             $this->_cache_info['template'][$resource_name] = true;
             if ($this->cache_modified_check && $display) {
                 header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
             }
         }
     }
     // load filters that are marked as autoload
     if (count($this->autoload_filters)) {
         foreach ($this->autoload_filters as $_filter_type => $_filters) {
             foreach ($_filters as $_filter) {
                 $this->load_filter($_filter_type, $_filter);
             }
         }
     }
     $_smarty_compile_path = $this->_get_compile_path($resource_name);
     // if we just need to display the results, don't perform output
     // buffering - for speed
     $_cache_including = $this->_cache_including;
     $this->_cache_including = false;
     if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
         if ($this->_is_compiled($resource_name, $_smarty_compile_path) || $this->_compile_resource($resource_name, $_smarty_compile_path)) {
             include $_smarty_compile_path;
         }
     } else {
         ob_start();
         if ($this->_is_compiled($resource_name, $_smarty_compile_path) || $this->_compile_resource($resource_name, $_smarty_compile_path)) {
             include $_smarty_compile_path;
         }
         $_smarty_results = ob_get_contents();
         ob_end_clean();
         foreach ((array) $this->_plugins['outputfilter'] as $_output_filter) {
             $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
         }
     }
     if ($this->caching) {
         $_params = array('tpl_file' => $resource_name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, 'results' => $_smarty_results);
         require_once SMARTY_CORE_DIR . 'core.write_cache_file.php';
         smarty_core_write_cache_file($_params, $this);
         require_once SMARTY_CORE_DIR . 'core.process_cached_inserts.php';
         $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
         if ($this->_cache_serials) {
             // strip nocache-tags from output
             $_smarty_results = preg_replace('!(\\{/?nocache\\:[0-9a-f]{32}#\\d+\\})!s', '', $_smarty_results);
         }
         // restore initial cache_info
         $this->_cache_info = array_pop($_cache_info);
     }
     $this->_cache_including = $_cache_including;
     if ($display) {
         if (isset($_smarty_results)) {
             ##############################################################################################
             # Code to protect email against spam. All email in the content of the site will be changed
             # by TheRplima
             ##############################################################################################
             global $icmsConfigPersona;
             if ($icmsConfigPersona['email_protect'] != 0) {
                 if (preg_match_all("/([a-z0-9\\-_\\.]+?)@([^, \r\n\"\\(\\)'<>\\[\\]]+)/i", $_smarty_results, $texto)) {
                     $patterns = array();
                     $replacements = array();
                     foreach ($texto[0] as $email) {
                         if (preg_match_all("/mailto(.*?){$email}/i", $_smarty_results, $texto1) || preg_match_all("/value=['\"]{$email}/i", $_smarty_results, $texto1) || preg_match_all("/{$email}(.*?)<\\/textarea>/i", $_smarty_results, $texto1)) {
                             //Dont allow to change the email inside input or textarea form fields
                             continue;
                         }
                         $protection_type = intval($icmsConfigPersona['email_protect']);
                         if ($protection_type == 1 && function_exists('gd_info')) {
                             $patterns[] = '/' . $email . '/';
                             $replacements[] = "<img src='" . ICMS_URL . "/include/protection.php?p=" . base64_encode(urlencode($email)) . "'>";
                         } elseif ($protection_type == 2 && function_exists('mcrypt_encrypt') && isset($icmsConfigPersona['recprvkey']) && $icmsConfigPersona['recprvkey'] != '' && isset($icmsConfigPersona['recpubkey']) && $icmsConfigPersona['recpubkey'] != '') {
                             require_once ICMS_LIBRARIES_PATH . '/recaptcha/recaptchalib.php';
                             $patterns[] = '/' . $email . '/';
                             $replacements[] = recaptcha_mailhide_html($icmsConfigPersona['recpubkey'], $icmsConfigPersona['recprvkey'], $email);
                         }
                         // using reCaptcha methode
                     }
                     $_smarty_results = preg_replace($patterns, $replacements, $_smarty_results);
                 }
             }
             ##############################################################################################
             # Fim
             ##############################################################################################
             echo $_smarty_results;
         }
         if ($this->debugging) {
             // capture time for debugging info
             $_params = array();
             require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
             $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
             require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
             echo smarty_core_display_debug_console($_params, $this);
         }
         error_reporting($_smarty_old_error_level);
         return;
     } else {
         error_reporting($_smarty_old_error_level);
         if (isset($_smarty_results)) {
             ##############################################################################################
             # Code to protect email against spam. All email in the content of the site will be changed
             # by TheRplima
             ##############################################################################################
             global $icmsConfigPersona;
             if ($icmsConfigPersona['email_protect'] != 0) {
                 if (preg_match_all("/([a-z0-9\\-_\\.]+?)@([^, \r\n\"\\(\\)'<>\\[\\]]+)/i", $_smarty_results, $texto)) {
                     $patterns = array();
                     $replacements = array();
                     foreach ($texto[0] as $email) {
                         if (preg_match_all("/mailto(.*?){$email}/i", $_smarty_results, $texto1) || preg_match_all("/value=['\"]{$email}/i", $_smarty_results, $texto1) || preg_match_all("/{$email}(.*?)<\\/textarea>/i", $_smarty_results, $texto1)) {
                             //Dont allow to change the email inside input or textarea form fields
                             continue;
                         }
                         $protection_type = intval($icmsConfigPersona['email_protect']);
                         if ($protection_type == 1 && function_exists('gd_info')) {
                             $patterns[] = '/' . $email . '/';
                             $replacements[] = "<img src='" . ICMS_URL . "/include/protection.php?p=" . base64_encode(urlencode($email)) . "'>";
                         } elseif ($protection_type == 2 && function_exists('mcrypt_encrypt') && isset($icmsConfigPersona['recprvkey']) && $icmsConfigPersona['recprvkey'] != '' && isset($icmsConfigPersona['recpubkey']) && $icmsConfigPersona['recpubkey'] != '') {
                             require_once ICMS_LIBRARIES_PATH . '/recaptcha/recaptchalib.php';
                             $patterns[] = '/' . $email . '/';
                             $replacements[] = recaptcha_mailhide_html($icmsConfigPersona['recpubkey'], $icmsConfigPersona['recprvkey'], $email);
                         }
                         // using reCaptcha methode
                     }
                     $_smarty_results = preg_replace($patterns, $replacements, $_smarty_results);
                 }
             }
             ##############################################################################################
             # Fim
             ##############################################################################################
             return $_smarty_results;
         }
     }
 }
<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>