Commit ab076637 authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

Various changes


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@71 709f56b5-9817-0410-a4d7-c38de5d9e867
parent d983885d
......@@ -1838,6 +1838,7 @@ class t3lib_div {
/**
* Reads the file or url $url and returns the content
* If you are having trouble with proxys when reading URLs you can configure your way out of that with settings like $TYPO3_CONF_VARS['SYS']['curlUse'] etc.
*
* Usage: 79
*
......
......@@ -440,7 +440,7 @@ class t3lib_parsehtml {
* @param string $content; is the HTML-content being processed. This is also the result being returned.
* @param array $tags; is an array where each key is a tagname in lowercase. Only tags present as keys in this array are preserved. The value of the key can be an array with a vast number of options to configure.
* @param string $keepAll; boolean/'protect', if set, then all tags are kept regardless of tags present as keys in $tags-array. If 'protect' then the preserved tags have their <> converted to &lt; and &gt;
* @param integer $hSC; Values -1,0,1: Set to zero= disabled, set to 1 then the content BETWEEN tags is htmlspecialchar()'ed.
* @param integer $hSC; Values -1,0,1,2: Set to zero= disabled, set to 1 then the content BETWEEN tags is htmlspecialchar()'ed, set to -1 its the opposite and set to 2 the content will be HSC'ed BUT with preservation for real entities (eg. "&amp;" or "&#234;")
* @param array Configuration array send along as $conf to the internal functions ->processContent() and ->processTag()
* @return string Processed HTML content
*/
......@@ -688,16 +688,18 @@ class t3lib_parsehtml {
}
/**
* Converts htmlspecialchars forth ($dir=1) AND back ($dir=0)
* Converts htmlspecialchars forth ($dir=1) AND back ($dir=-1)
*
* @param string Input value
* @param integer Direction: forth ($dir=1) AND back ($dir=0)
* @param integer Direction: forth ($dir=1, dir=2 for preserving entities) AND back ($dir=-1)
* @return string Output value
*/
function bidir_htmlspecialchars($value,$dir) {
if ($dir>0) {
if ($dir==1) {
$value = htmlspecialchars($value);
} elseif ($dir<0) {
} elseif ($dir==2) {
$value = t3lib_div::deHSCentities(htmlspecialchars($value));
} elseif ($dir==-1) {
$value = str_replace('&gt;','>',$value);
$value = str_replace('&lt;','<',$value);
$value = str_replace('&quot;','"',$value);
......@@ -832,8 +834,8 @@ class t3lib_parsehtml {
* @return string Processed HTML content
*/
function mapTags($value,$tags=array(),$ltChar='<',$ltChar2='<') {
reset($tags);
while(list($from,$to)=each($tags)) {
foreach($tags as $from => $to) {
$value = eregi_replace($ltChar.$from.'>',$ltChar2.$to.'>',$value);
$value = eregi_replace($ltChar.$from.'[[:space:]]([^>]*)>',$ltChar2.$to.' \\1>',$value);
$value = eregi_replace($ltChar.'\/'.$from.'[^>]*>',$ltChar2.'/'.$to.'>',$value);
......@@ -1055,7 +1057,18 @@ class t3lib_parsehtml {
}
}
return array($keepTags, ''.$TSconfig['keepNonMatchedTags'], intval($TSconfig['htmlSpecialChars']));
// Create additional configuration:
$addConfig=array();
if ($TSconfig['xhtml_cleaning']) {
$addConfig['xhtml']=1;
}
return array(
$keepTags,
''.$TSconfig['keepNonMatchedTags'],
intval($TSconfig['htmlSpecialChars']),
$addConfig
);
}
/**
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ $TYPO3_CONF_VARS = Array(
'encryptionKey' => '', // Insert some unique string here! Used in eg. direct mail module to generate a md5 hash in combination with uid. This string should be kept secret although it's not as critical as a password.
'doNotCheckReferer' => 0, // Boolean. If set, it's NOT checked numerous places that the refering host is the same as the current. This is an option you should set if you have problems with proxies not passing the HTTP_REFERER variable.
'recursiveDomainSearch' => 0, // Boolean. If set, the search for domain records will be done recursively by stripping parts of the host name off until a matching domain record is found.
'report_error_html' => chr(10).'Please report this error to the <a href="mailto:kasper@typo3.com">Typo Development Team</a>',
'report_error_html' => chr(10).'Please report this error to the <a href="mailto:kasper@typo3.com">TYPO3 Development Team</a>',
'T3instID' => 'N/A',
'devIPmask' => '192.168.*,127.0.0.1', // Defines a list of IP addresses which will allow development-output to display. The debug() function will use this as a filter. See the function t3lib_div::cmpIP() for details on syntax. Setting this to blank value will deny all. Setting to '*' will allow all.
'curlUse' => 0, // Boolean: If set, try to use Curl to fetch external URLs (implemented by Arco <arco@appeltaart.mine.nu>)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -332,7 +332,6 @@ TABLE#typo3-permissionList IMG { vertical-align: middle; }
/*********************************************
* VARIOUS STAND-ALONE classes:
*********************************************/
......
......@@ -406,7 +406,7 @@ class SC_db_layout {
}
} else document.location = URL;
}
'.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,'',t3lib_BEfunc::BEgetRootLine($this->id)) : '').'
'.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').'
function deleteRecord(table,id,url) { //
if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {
......
......@@ -1693,7 +1693,7 @@ class tslib_cObj {
if($image) {
$fieldCode = str_replace('<img','<input type="image"'.$addParams.' name="'.$confData['fieldname'].'"' ,$image);
} else {
$fieldCode=sprintf('<input type="submit" name="%s" value="%s"'.$addParams.'>',
$fieldCode=sprintf('<input type="submit" name="%s" value="%s"'.$addParams.' />',
$confData['fieldname'], htmlspecialchars($value));
}
break;
......@@ -1805,9 +1805,17 @@ class tslib_cObj {
$GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
} else $validateForm='';
// Create form tag:
$theTarget = ($theRedirect?$LD['target']:$LD_A['target']);
$content = Array(
'<form action="'.htmlspecialchars($action).'" name="'.$formname.'" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" method="'.($conf['method']?$conf['method']:'post').'" target="'.($theRedirect?$LD['target']:$LD_A['target']).'"'.$validateForm.'>',
'<form'.
' action="'.htmlspecialchars($action).'"'.
' name="'.$formname.'"'.
' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
' method="'.($conf['method']?$conf['method']:'post').'"'.
($theTarget ? ' target="'.$theTarget.'"' : '').
$validateForm.
'>',
$hiddenfields.$content,
'</form>'
);
......@@ -2386,7 +2394,7 @@ class tslib_cObj {
} else {
$target = ' target="thePicture"';
if (isset($conf['target'])) {
$target= ($conf['target']) ? ' target="'.$conf['target'].'"' : '';
$target= $conf['target'] ? ' target="'.$conf['target'].'"' : '';
}
$a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
$a2='</a>';
......@@ -2842,6 +2850,10 @@ class tslib_cObj {
if ($conf['crop']){$content=$this->crop($content, $conf['crop']);}
if ($conf['stripHtml']){$content=strip_tags($content);}
if ($conf['htmlSpecialChars']){$content=htmlSpecialChars($content);}
if ($conf['htmlSpecialChars']){
$content=htmlSpecialChars($content);
if ($conf['htmlSpecialChars.']['preserveEntities']) $content = t3lib_div::deHSCentities($content);
}
if ($conf['doubleBrTag']) {
$content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
......@@ -3126,7 +3138,7 @@ class tslib_cObj {
function HTMLparser_TSbridge($theValue, $conf) {
$htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
$htmlParserCfg = $htmlParser->HTMLparserConfig($conf);
return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2]);
return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2],$htmlParserCfg[3]);
}
/**
......@@ -3925,7 +3937,7 @@ class tslib_cObj {
// Default align
if (!$attrib['align'] && $defaultAlign) $attrib['align']=$defaultAlign;
$params = t3lib_div::implodeParams($attrib);
$params = t3lib_div::implodeParams($attrib,1);
if ($conf['removeWrapping']) {
$str_content=$str_content;
} else {
......@@ -3983,9 +3995,17 @@ class tslib_cObj {
}
$target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
$res = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'" target="'.$target.'"'.$aTagParams.'>';
$res = '<a'.
' href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.
($target ? ' target="'.$target.'"' : '').
$aTagParams.
'>';
} else {
$res = '<a href="http://'.htmlspecialchars($parts[0]).'" target="'.$target.'"'.$aTagParams.'>';
$res = '<a'.
' href="http://'.htmlspecialchars($parts[0]).'"'.
($target ? ' target="'.$target.'"' : '').
$aTagParams.
'>';
}
if ($conf['ATagBeforeWrap']) {
$res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
......@@ -4513,7 +4533,7 @@ class tslib_cObj {
}
$this->lastTypoLinkTarget = $target;
$finalTagParts['url']=$this->lastTypoLinkUrl;
$finalTagParts['targetParams']=' target="'.$target.'"';
$finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
$finalTagParts['TYPE']='url';
} elseif ($fileChar || $isLocalFile) { // file (internal)
$splitLinkParam = explode('?',$link_param);
......@@ -4528,7 +4548,7 @@ class tslib_cObj {
$this->lastTypoLinkTarget = $target;
$finalTagParts['url']=$this->lastTypoLinkUrl;
$finalTagParts['targetParams']=' target="'.$target.'"';
$finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
$finalTagParts['TYPE']='file';
} else {
$GLOBALS['TT']->setTSlogMessage("typolink(): File '".$splitLinkParam[0]."' did not exist, so '".$linktxt."' was not linked.",1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment