Bug #14984 » utf8_JS_2005-10-26.patch

Administrator Admin, 2005-10-26 17:56

View differences:

TYPO3core.utfjs/t3lib/class.t3lib_div.php 2005-10-22 18:12:41.922450248 +0200
3881 3881

  
3882 3882
		return $paramsArr;
3883 3883
	}
3884

  
3885
	function quoteJSvalue($value, $inScriptTags = false)	{
3886
		$value = addcslashes($value, '\'');
3887
		if (!$inScriptTags)	{
3888
			$value = htmlspecialchars($value);
3889
		}
3890
		return '\''.$value.'\'';
3891
	}
3892

  
3893

  
3884 3894
}
3885 3895

  
3886 3896
?>
TYPO3core.utfjs/t3lib/class.t3lib_tsfebeuserauth.php 2005-10-22 19:49:29.268925576 +0200
879 879
			#include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
880 880
			if (!is_array($LOCAL_LANG))		$LOCAL_LANG=array();
881 881
		}
882

  
883
		$labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));	// Label string in the default backend output charset.
884

  
882
			
885 883
			// Convert to utf-8, then to entities:
886 884
		if ($GLOBALS['LANG']->charSet!='utf-8')	{
887
			$labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
885
			$labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($GLOBALS['LANG']->getLL($key), $GLOBALS['LANG']->charSet);
888 886
		}
889
		$labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
887

  
888
		$labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));	// Label string in the default backend output charset.
890 889

  
891 890
			// Return the result:
892 891
		return $labelStr;
TYPO3core.utfjs/t3lib/jsfunc.menu.js 2005-10-22 18:43:20.576103584 +0200
52 52
function JSmenuAddItem (parent,prevItem,openID,title,url,target) {
53 53
	this.count++;
54 54
	var entryID = this.count;
55
	this.entry[entryID] = new JSmenuItem (this, entryID, 0, parent, openID, unescape(title), unescape(url), target);
55
	this.entry[entryID] = new JSmenuItem (this, entryID, 0, parent, openID, title, url, target);
56 56
	if (prevItem) {
57 57
		this.entry[prevItem].nextItem = entryID;
58 58
	} else if(parent) {
TYPO3core.utfjs/typo3/sysext/cms/tslib/class.tslib_content.php 2005-10-22 19:47:30.798935752 +0200
1971 1971
		$hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
1972 1972

  
1973 1973
		if ($conf['REQ'])	{
1974
			$validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\',\''.rawurlencode($conf['goodMess']).'\',\''.rawurlencode($conf['badMess']).'\',\''.rawurlencode($conf['emailMess']).'\')"';
1974
			$validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
1975 1975
			$GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
1976 1976
		} else $validateForm='';
1977 1977

  
......
5812 5812
				reset($value);
5813 5813
				while(list(,$Nvalue)=each($value))	{
5814 5814
					$JSPart.="
5815
	updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',unescape('".rawurlencode($Nvalue)."'))";
5815
	updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).")";
5816 5816
				}
5817 5817

  
5818 5818
			} else {
5819 5819
				$JSPart.="
5820
	updateForm('".$formName."','".$arrPrefix."[".$fKey."]',unescape('".rawurlencode($value)."'))";
5820
	updateForm('".$formName."','".$arrPrefix."[".$fKey."]',".t3lib_div::quoteJSvalue($value, true).")";
5821 5821
			}
5822 5822
		}
5823 5823
		$JSPart='<script type="text/javascript">
......
6817 6817
			}
6818 6818
		} else {
6819 6819
			if ($confirm)	{
6820
				$cf1="if (confirm(unescape('".t3lib_div::rawurlencodeJS($confirm)."'))){";
6820
				$cf1="if (confirm(".str_replace(chr(10), '\n', t3lib_div::quoteJSvalue($confirm, true)).")){";			// Gets htmlspecialchared later
6821 6821
				$cf2='}';
6822 6822
			} else {
6823 6823
				$cf1=$cf2='';
TYPO3core.utfjs/typo3/sysext/cms/tslib/class.tslib_menu.php 2005-10-22 19:09:45.506669096 +0200
2719 2719
					} else {
2720 2720
						$addLines = '';
2721 2721
					}
2722
					$title=rawurlencode($data['title']);
2722
					$title=$data['title'];
2723 2723
					$url='';
2724 2724
					$target='';
2725 2725
					if ((!$addLines && !$levelConf['noLink']) || $levelConf['alwaysLink']) {
......
2731 2731
						$url = rawurlencode($LD['totalURL']);
2732 2732
						$target = rawurlencode($LD['target']);
2733 2733
					}
2734
					$codeLines.="\n".$var.$count."=".$menuName.".add(".$parent.",".$prev.",0,'".$title."','".$GLOBALS['TSFE']->baseUrlWrap($url)."','".$target."');";
2734
					$codeLines.="\n".$var.$count."=".$menuName.".add(".$parent.",".$prev.",0,".t3lib_div::quoteJSvalue($title, true).",'".$GLOBALS['TSFE']->baseUrlWrap($url)."','".$target."');";
2735 2735
						// If the active one should be chosen...
2736 2736
					$active = ($levelConf['showActive'] && $data['uid'] == $this->tmpl->rootLine[$count]['uid']);
2737 2737
						// If the first item should be shown
......
2756 2756
			$levelConf['firstLabel'] = $this->mconf['firstLabelGeneral'];
2757 2757
		}
2758 2758
		if ($levelConf['firstLabel'] && $codeLines)	{
2759
			$codeLines.="\n".$menuName.".defTopTitle[".$count."] = unescape('".rawurlencode($levelConf['firstLabel'])."');";
2759
			$codeLines.= chr(10).$menuName.'.defTopTitle['.$count.'] = '.t3lib_div::quoteJSvalue($levelConf['firstLabel'], true).';';
2760 2760
		}
2761 2761
		return $codeLines;
2762 2762
	}
(3-3/3)