Project

General

Profile

Bug #14264 » utf8_JS_2005-12-13.patch

Administrator Admin, 2006-01-17 21:39

View differences:

TYPO3core.jsutf8/t3lib/class.t3lib_div.php 2005-12-13 13:32:17.224633960 +0100
}
return $paramsArr;
}
/**
* Quotes a string for usage as JS parameter. Depends wheter the value is used in script tags (it doesn't need/must not get htmlspecialchared in this case)
*
* @param string The string to encode.
* @param boolean If the values get's used in <script> tags.
* @return string The encoded value already quoted
*/
function quoteJSvalue($value, $inScriptTags = false) {
$value = addcslashes($value, '\''.chr(10).chr(13));
if (!$inScriptTags) {
$value = htmlspecialchars($value);
}
return '\''.$value.'\'';
}
}
?>
TYPO3core.jsutf8/t3lib/jsfunc.menu.js 2005-12-13 13:15:56.486728784 +0100
function JSmenuAddItem (parent,prevItem,openID,title,url,target) {
this.count++;
var entryID = this.count;
this.entry[entryID] = new JSmenuItem (this, entryID, 0, parent, openID, unescape(title), unescape(url), target);
this.entry[entryID] = new JSmenuItem (this, entryID, 0, parent, openID, title, url, target);
if (prevItem) {
this.entry[prevItem].nextItem = entryID;
} else if(parent) {
TYPO3core.jsutf8/typo3/browse_links.php 2005-12-13 13:32:00.758137248 +0100
$title = $row[$titleCol];
$ficon = t3lib_iconWorks::getIcon($table,$row);
$aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', unescape('".rawurlencode($title)."'), '', '', '".$ficon."');";
$ATag = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">';
$aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div::quoteJSvalue($title).", '', '', '".$ficon."');";
$ATag = '<a href="#" onclick="'.$aOnClick.'">';
$ATag_alt = substr($ATag,0,-4).',\'\',1);">';
$ATag_e = '</a>';
......
function wrapTitle($title,$v,$ext_pArrPages) {
if ($ext_pArrPages) {
$ficon=t3lib_iconWorks::getIcon('pages',$v);
$onClick = "return insertElement('pages', '".$v['uid']."', 'db', unescape('".rawurlencode($v['title'])."'), '', '', '".$ficon."','',1);";
$onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
} else {
$onClick = 'return jumpToUrl(\'browse_links.php?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandPage='.$v['uid'].'\');';
}
return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$title.'</a>';
return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
}
}
......
$ATag2='';
if (in_array('pages',$tablesArr)) {
$ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
$ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',1);\">";
$ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',0);\">";
$ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
$ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
$ATag_alt=substr($ATag,0,-4).",'',1);\">";
$ATag_e='</a>';
}
TYPO3core.jsutf8/typo3/sysext/cms/tslib/class.tslib_content.php 2005-12-13 13:15:56.490728176 +0100
$hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
if ($conf['REQ']) {
$validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\',\''.rawurlencode($conf['goodMess']).'\',\''.rawurlencode($conf['badMess']).'\',\''.rawurlencode($conf['emailMess']).'\')"';
$validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
$GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
} else $validateForm='';
......
reset($value);
while(list(,$Nvalue)=each($value)) {
$JSPart.="
updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',unescape('".rawurlencode($Nvalue)."'))";
updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).")";
}
} else {
$JSPart.="
updateForm('".$formName."','".$arrPrefix."[".$fKey."]',unescape('".rawurlencode($value)."'))";
updateForm('".$formName."','".$arrPrefix."[".$fKey."]',".t3lib_div::quoteJSvalue($value, true).")";
}
}
$JSPart='<script type="text/javascript">
......
}
} else {
if ($confirm) {
$cf1="if (confirm(unescape('".t3lib_div::rawurlencodeJS($confirm)."'))){";
$cf1="if (confirm(".str_replace(chr(10), '\n', t3lib_div::quoteJSvalue($confirm, true)).")){"; // Gets htmlspecialchared later
$cf2='}';
} else {
$cf1=$cf2='';
TYPO3core.jsutf8/typo3/sysext/cms/tslib/class.tslib_menu.php 2005-12-13 13:15:56.492727872 +0100
} else {
$addLines = '';
}
$title=rawurlencode($data['title']);
$title=$data['title'];
$url='';
$target='';
if ((!$addLines && !$levelConf['noLink']) || $levelConf['alwaysLink']) {
......
$url = rawurlencode($LD['totalURL']);
$target = rawurlencode($LD['target']);
}
$codeLines.="\n".$var.$count."=".$menuName.".add(".$parent.",".$prev.",0,'".$title."','".$GLOBALS['TSFE']->baseUrlWrap($url)."','".$target."');";
$codeLines.="\n".$var.$count."=".$menuName.".add(".$parent.",".$prev.",0,".t3lib_div::quoteJSvalue($title, true).",'".$GLOBALS['TSFE']->baseUrlWrap($url)."','".$target."');";
// If the active one should be chosen...
$active = ($levelConf['showActive'] && $data['uid'] == $this->tmpl->rootLine[$count]['uid']);
// If the first item should be shown
......
$levelConf['firstLabel'] = $this->mconf['firstLabelGeneral'];
}
if ($levelConf['firstLabel'] && $codeLines) {
$codeLines.="\n".$menuName.".defTopTitle[".$count."] = unescape('".rawurlencode($levelConf['firstLabel'])."');";
$codeLines.= chr(10).$menuName.'.defTopTitle['.$count.'] = '.t3lib_div::quoteJSvalue($levelConf['firstLabel'], true).';';
}
return $codeLines;
}
(8-8/8)