Project

General

Profile

Feature #14311 » 0000351-tslib.patch

Administrator Admin, 2005-03-28 12:18

View differences:

class.tslib_content.php 2005-03-28 12:10:16.010866524 +0200
$parts[0] = substr($textpieces[$i],0,$len);
$parts[1] = substr($textpieces[$i],$len);
$linktxt = ereg_replace('\?.*','',$parts[0]);
if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0])."');";
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt = str_replace('@',$atLabel ? $atLabel : '(at)', $linktxt);
if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
$mailToUrl = $GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0]);
} else {
$mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0])."');";
}
if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
}
if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
$lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
$lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
$linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
}
} else {
$mailToUrl = 'mailto:'.$parts[0];
}
......
if ($linktxt=='') $linktxt = $link_param;
if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
$this->lastTypoLinkUrl = 'mailto:'.$link_param;
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$this->lastTypoLinkUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl)."');";
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt=str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
$this->lastTypoLinkUrl = $GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl);
} else {
$this->lastTypoLinkUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl)."');";
}
if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
}
if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
$lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
$lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
$linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
}
}
} else {
$this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('mailto:'.$link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
......
$onClick="vHWin=window.open('".$GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url'])."','FEopenLink','".$JSwindowParams."');vHWin.focus();return false;";
$res = '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
} else {
$res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
$res = '<a href="'.$finalTagParts['url'].'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
} else {
$res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
}
}
// Call user function:
-- class.tslib_fe.php 2005-03-23 14:57:22.000000000 +0100
++ class.tslib_fe.php 2005-03-28 12:10:48.440389239 +0200
......
*/
function encryptEmail($string,$back=0) {
$out = '';
for ($a=0; $a<strlen($string); $a++) {
$charValue = ord(substr($string,$a,1));
$charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
$out.= chr($charValue);
if ($this->spamProtectEmailAddresses == 'ascii') {
for ($a=0; $a<strlen($string); $a++) {
$out .= '&#'.ord(substr($string, $a, 1)).';';
}
} else {
for ($a=0; $a<strlen($string); $a++) {
$charValue = ord(substr($string,$a,1));
$charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
$out.= chr($charValue);
}
}
return $out;
}
......
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']);
}
?>
?>
-- class.tslib_pagegen.php 2005-02-04 01:53:12.000000000 +0100
++ class.tslib_pagegen.php 2005-03-28 12:11:11.825833921 +0200
......
// Internal and External target defaults
$GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
$GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
$GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] == 'ascii') {
$GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
} else {
$GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
// JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) { //
var n=0;
......
location.href=UnCryptMailto(s);
}
';
}
}
(2-2/2)