[ros-diffs] [cfinck] 30360: - Avoid confusions about double escaping certain quotes by now using PHP's addslashes() function for all strings, which are inserted into JavaScript strings. All strings in the translations now have to be escaped the "usual" way. - Move the translation correctly in "languages.inc.php".

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sun Nov 11 16:56:58 CET 2007


Author: cfinck
Date: Sun Nov 11 18:56:58 2007
New Revision: 30360

URL: http://svn.reactos.org/svn/reactos?rev=30360&view=rev
Log:
- Avoid confusions about double escaping certain quotes by now using PHP's addslashes() function for all strings, which are inserted into JavaScript strings.
  All strings in the translations now have to be escaped the "usual" way.
- Move the translation correctly in "languages.inc.php".

Modified:
    trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php
    trunk/web/reactos.org/htdocs/getbuilds/index.php
    trunk/web/reactos.org/htdocs/getbuilds/lang/fr.inc.php
    trunk/web/reactos.org/htdocs/getbuilds/lang/it.inc.php
    trunk/web/reactos.org/htdocs/getbuilds/languages.inc.php

Modified: trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php?rev=30360&r1=30359&r2=30360&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php (original)
+++ trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php Sun Nov 11 18:56:58 2007
@@ -91,7 +91,7 @@
 	{
 		// For some errors, we show a localized error message
 		if( http_request.responseXML.getElementsByTagName("message")[0].firstChild.data == "LIMIT" )
-			alert( '<?php printf( $getbuilds_langres["rangelimitexceeded"], "' + http_request.responseXML.getElementsByTagName(\"limit\")[0].firstChild.data + '" ); ?>' );
+			alert( '<?php printf( addslashes($getbuilds_langres["rangelimitexceeded"]), "' + http_request.responseXML.getElementsByTagName(\"limit\")[0].firstChild.data + '" ); ?>' );
 		else
 			alert( http_request.responseXML.getElementsByTagName("message")[0].firstChild.data );
 		
@@ -108,7 +108,7 @@
 		if( data["requesttype"] == "FirstPageFullLoad" )
 		{
 			filenum = parseInt( http_request.responseXML.getElementsByTagName("filenum")[0].firstChild.data );
-			html += '<?php printf( $getbuilds_langres["foundfiles"], "<span id=\"filenum\">' + filenum + '</span>" ); ?>';
+			html += '<?php printf( addslashes($getbuilds_langres["foundfiles"]), "<span id=\"filenum\">' + filenum + '</span>" ); ?>';
 		}
 		else
 			html += document.getElementById("infobox").innerHTML;
@@ -121,12 +121,12 @@
 		if( currentpage == 1 )
 		{
 			html += '<strong>&laquo;</strong> ';
-			html += '<strong>&lsaquo; <?php echo $getbuilds_langres["prevpage"]; ?></strong> ';
-		}
-		else
-		{
-			html += '<a href="javascript:firstPage()" title="<?php echo $getbuilds_langres["firstpage_title"]; ?>">&laquo;</a> ';
-			html += '<a href="javascript:prevPage()" title="<?php echo $getbuilds_langres["prevpage_title"]; ?>">&lsaquo; <?php echo $getbuilds_langres["prevpage"]; ?></a> ';
+			html += '<strong>&lsaquo; <?php echo addslashes($getbuilds_langres["prevpage"]); ?></strong> ';
+		}
+		else
+		{
+			html += '<a href="javascript:firstPage()" title="<?php echo addslashes($getbuilds_langres["firstpage_title"]); ?>">&laquo;</a> ';
+			html += '<a href="javascript:prevPage()" title="<?php echo addslashes($getbuilds_langres["prevpage_title"]); ?>">&lsaquo; <?php echo addslashes($getbuilds_langres["prevpage"]); ?></a> ';
 		}
 		
 		html += '<select id="pagesel" size="1" onchange="pageboxChange(this)">';
@@ -135,7 +135,7 @@
 		{
 			pagecount = 1;
 			
-			html += '<option selected="selected" value="' + currentpage + '-' + startrev + '"><?php echo $getbuilds_langres["page"]; ?> ' + currentpage;
+			html += '<option selected="selected" value="' + currentpage + '-' + startrev + '"><?php echo addslashes($getbuilds_langres["page"]); ?> ' + currentpage;
 			
 			if( http_request.responseXML.getElementsByTagName("filenum")[0].firstChild.data > 0 )
 				html += ' - ' + http_request.responseXML.getElementsByTagName("firstrev")[0].firstChild.data + ' ... ' + http_request.responseXML.getElementsByTagName("lastrev")[0].firstChild.data + '</option>';
@@ -147,26 +147,26 @@
 		
 		if( http_request.responseXML.getElementsByTagName("morefiles")[0].firstChild.data == 0 )
 		{
-			html += '<strong><?php echo $getbuilds_langres["nextpage"]; ?> &rsaquo;</strong> ';
+			html += '<strong><?php echo addslashes($getbuilds_langres["nextpage"]); ?> &rsaquo;</strong> ';
 			html += '<strong>&raquo;</strong>';
 		}
 		else
 		{
-			html += '<a href="javascript:nextPage()" title="<?php echo $getbuilds_langres["nextpage_title"]; ?>"><?php echo $getbuilds_langres["nextpage"]; ?> &rsaquo;</a> ';
-			html += '<a href="javascript:lastPage()" title="<?php echo $getbuilds_langres["lastpage_title"]; ?>">&raquo;</a>';
+			html += '<a href="javascript:nextPage()" title="<?php echo addslashes($getbuilds_langres["nextpage_title"]); ?>"><?php echo addslashes($getbuilds_langres["nextpage"]); ?> &rsaquo;</a> ';
+			html += '<a href="javascript:lastPage()" title="<?php echo addslashes($getbuilds_langres["lastpage_title"]); ?>">&raquo;</a>';
 		}
 		
 		html += '</td></tr></table>';
 
 		// File table
 		html += '<table class="datatable" cellspacing="0" cellpadding="1">';
-		html += '<thead><tr class="head"><th class="fname"><?php echo $getbuilds_langres["filename"]; ?></th><th class="fsize"><?php echo $getbuilds_langres["filesize"]; ?></th><th class="fdate"><?php echo $getbuilds_langres["filedate"]; ?></th></tr></thead>';
+		html += '<thead><tr class="head"><th class="fname"><?php echo addslashes($getbuilds_langres["filename"]); ?></th><th class="fsize"><?php echo addslashes($getbuilds_langres["filesize"]); ?></th><th class="fdate"><?php echo addslashes($getbuilds_langres["filedate"]); ?></th></tr></thead>';
 		html += '<tbody>';
 		
 		var files = http_request.responseXML.getElementsByTagName("file");
 	
 		if( files.length == 0 )
-			html += '<tr class="odd"><td><?php printf( $getbuilds_langres["nofiles"], "' + fullrange + '" ); ?></td><td>&nbsp;</td><td>&nbsp;</td></tr>';
+			html += '<tr class="odd"><td><?php printf( addslashes($getbuilds_langres["nofiles"]), "' + fullrange + '" ); ?></td><td>&nbsp;</td><td>&nbsp;</td></tr>';
 		else
 		{
 			var oddeven = false;
@@ -216,7 +216,7 @@
 		// If I use "innerHTML" here, the first <OPTION> start tag gets dropped in the IE...
 		// Therefore I have to use the DOM functions in this case.
 		var option_elem = document.createElement("option");
-		var option_text = document.createTextNode( '<?php echo $getbuilds_langres["page"]; ?> ' + pagecount + ' - ' + http_request.responseXML.getElementsByTagName("firstrev")[0].firstChild.data + ' ... ' + http_request.responseXML.getElementsByTagName("lastrev")[0].firstChild.data );
+		var option_text = document.createTextNode( '<?php echo addslashes($getbuilds_langres["page"]); ?> ' + pagecount + ' - ' + http_request.responseXML.getElementsByTagName("firstrev")[0].firstChild.data + ' ... ' + http_request.responseXML.getElementsByTagName("lastrev")[0].firstChild.data );
 		
 		option_elem.value = pagecount + "-" + data["new_startrev"];
 		option_elem.appendChild( option_text );

Modified: trunk/web/reactos.org/htdocs/getbuilds/index.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/index.php?rev=30360&r1=30359&r2=30360&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/getbuilds/index.php (original)
+++ trunk/web/reactos.org/htdocs/getbuilds/index.php Sun Nov 11 18:56:58 2007
@@ -149,19 +149,19 @@
 			document.write(
 				'<table id="showrev" cellspacing="0" cellpadding="5">' +
 					'<tr>' +
-						'<td><?php echo $getbuilds_langres["showrevfiles"]; ?>: </td>' +
+						'<td><?php echo addslashes($getbuilds_langres["showrevfiles"]); ?>: </td>' +
 						'<td>' +
 							'<span id="revcontrols">' +
-								'<img src="images/leftarrow.gif" alt="&lt;" title="<?php echo $getbuilds_langres["prevrev"]; ?>" onclick="prevRev();"> ' +
+								'<img src="images/leftarrow.gif" alt="&lt;" title="<?php echo addslashes($getbuilds_langres["prevrev"]); ?>" onclick="prevRev();"> ' +
 								'<input type="text" id="revnum" value="<?php echo $rev; ?>" size="12" onkeyup="checkRevNum(this);"> ' +
-								'<img src="images/rightarrow.gif" alt="&gt;" title="<?php echo $getbuilds_langres["nextrev"]; ?>" onclick="nextRev();"><br>' +
+								'<img src="images/rightarrow.gif" alt="&gt;" title="<?php echo addslashes($getbuilds_langres["nextrev"]); ?>" onclick="nextRev();"><br>' +
 							'</span>' +
 							
-							'<img src="images/info.gif" alt="INFO:"> <?php printf( $getbuilds_langres["rangeinfo"], $rev, ($rev - 50), $rev ); ?>' +
+							'<img src="images/info.gif" alt="INFO:"> <?php printf( addslashes($getbuilds_langres["rangeinfo"]), $rev, ($rev - 50), $rev ); ?>' +
 						'</td>' +
 					'</tr>' +
 					'<tr>' +
-						'<td><?php echo $getbuilds_langres["isotype"]; ?>: </td>' +
+						'<td><?php echo addslashes($getbuilds_langres["isotype"]); ?>: </td>' +
 						'<td>' +
 							'<input type="checkbox" id="bootcd-dbg" checked="checked"> Debug Boot CDs ' +
 							'<input type="checkbox" id="livecd-dbg" checked="checked"> Debug Live CDs ' +
@@ -172,10 +172,10 @@
 				'</table>'	 +
 
 				'<div id="controlbox">' +
-					'<input type="button" onclick="showRev();" value="<?php echo $getbuilds_langres["showrev"]; ?>" />' +
+					'<input type="button" onclick="showRev();" value="<?php echo addslashes($getbuilds_langres["showrev"]); ?>" />' +
 					
 					'<span id="ajaxloadinginfo">' +
-						'<img src="images/ajax_loading.gif"> <?php echo $getbuilds_langres["gettinglist"]; ?>...' +
+						'<img src="images/ajax_loading.gif"> <?php echo addslashes($getbuilds_langres["gettinglist"]); ?>...' +
 					'</span>' +
 				'</div>' +
 
@@ -183,14 +183,14 @@
 					'<table class="datatable" cellspacing="0" cellpadding="1">' +
 						'<thead>' +
 							'<tr class="head">' +
-								'<th class="fname"><?php echo $getbuilds_langres["filename"]; ?></th>' +
-								'<th class="fsize"><?php echo $getbuilds_langres["filesize"]; ?></th>' +
-								'<th class="fdate"><?php echo $getbuilds_langres["filedate"]; ?></th>' +
+								'<th class="fname"><?php echo addslashes($getbuilds_langres["filename"]); ?></th>' +
+								'<th class="fsize"><?php echo addslashes($getbuilds_langres["filesize"]); ?></th>' +
+								'<th class="fdate"><?php echo addslashes($getbuilds_langres["filedate"]); ?></th>' +
 							'</tr>' +
 						'</thead>' +
 						'<tbody>' +
 							'<tr class="odd">' +
-								'<td><?php echo $getbuilds_langres["pleasewait"]; ?>...</td>' +
+								'<td><?php echo addslashes($getbuilds_langres["pleasewait"]); ?>...</td>' +
 								'<td>&nbsp;</td>' +
 								'<td>&nbsp;</td>' +
 							'</tr>' +

Modified: trunk/web/reactos.org/htdocs/getbuilds/lang/fr.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/lang/fr.inc.php?rev=30360&r1=30359&r2=30360&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/getbuilds/lang/fr.inc.php (original)
+++ trunk/web/reactos.org/htdocs/getbuilds/lang/fr.inc.php Sun Nov 11 18:56:58 2007
@@ -31,7 +31,7 @@
 	$getbuilds_langres["showrev"] = "Montrer";
 	$getbuilds_langres["gettinglist"] = "Récupération de la liste des fichiers";
 	$getbuilds_langres["rangeinfo"] = "Vous pouvez entrer un numéro de révision (p.e. %s) ou un intervalle de révisions (p.e. %s-%s)";
-	$getbuilds_langres["isotype"] = "Montrer les types d\'images de CD ";
+	$getbuilds_langres["isotype"] = "Montrer les types d'images de CD ";
 	
 	$getbuilds_langres["foundfiles"] = "%s fichiers trouvés !";
 	
@@ -48,8 +48,8 @@
 	$getbuilds_langres["filedate"] = "Derniers changements";
 	$getbuilds_langres["pleasewait"] = "Veuillez patienter";
 	
-	$getbuilds_langres["nofiles"] 	 = "Il n\'y a pas de fichiers disponibles pour la révision %s !";
+	$getbuilds_langres["nofiles"] 	 = "Il n'y a pas de fichiers disponibles pour la révision %s !";
 	$getbuilds_langres["invalidrev"] = "Numéro de révision invalide !";
 	
-	$getbuilds_langres["rangelimitexceeded"] = "L\'intervalle de révisions ne peut contenir qu\'un maximum de %s révisions !";
+	$getbuilds_langres["rangelimitexceeded"] = "L'intervalle de révisions ne peut contenir qu'un maximum de %s révisions !";
 ?>

Modified: trunk/web/reactos.org/htdocs/getbuilds/lang/it.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/lang/it.inc.php?rev=30360&r1=30359&r2=30360&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/getbuilds/lang/it.inc.php (original)
+++ trunk/web/reactos.org/htdocs/getbuilds/lang/it.inc.php Sun Nov 11 18:56:58 2007
@@ -29,7 +29,7 @@
 	$getbuilds_langres["prevrev"] = "Revisione precedente";
 	$getbuilds_langres["nextrev"] = "Revisione successiva";
 	$getbuilds_langres["showrev"] = "Mostrare";
-	$getbuilds_langres["gettinglist"] = "Ottentendo l\'elenco dei file";
+	$getbuilds_langres["gettinglist"] = "Ottentendo l'elenco dei file";
 	$getbuilds_langres["rangeinfo"] = "Puoi inserire un numero di revisione (ad es. %s) oppure un range di revisioni (ad es. %s-%s)";
 	$getbuilds_langres["isotype"] = "Mostrare imagini cd";
 	
@@ -41,7 +41,7 @@
 	$getbuilds_langres["page"] = "Pagina";
 	$getbuilds_langres["nextpage"] = "Successiva";
 	$getbuilds_langres["nextpage_title"] = "Pagina successiva";
-	$getbuilds_langres["lastpage_title"] = "Andare all\'ultima pagina";
+	$getbuilds_langres["lastpage_title"] = "Andare all'ultima pagina";
 	
 	$getbuilds_langres["filename"] = "Nome file";
 	$getbuilds_langres["filesize"] = "Dimensioni";

Modified: trunk/web/reactos.org/htdocs/getbuilds/languages.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/languages.inc.php?rev=30360&r1=30359&r2=30360&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/getbuilds/languages.inc.php (original)
+++ trunk/web/reactos.org/htdocs/getbuilds/languages.inc.php Sun Nov 11 18:56:58 2007
@@ -11,8 +11,8 @@
 	$getbuilds_languages = array(
 		"en" => "English",
 		"de" => "Deutsch (German)",
+		"es" => "Español (Spanish)",
 		"fr" => "Français (French)",
-		"es" => "Español (Spanish)",
 		"it" => "Italiano (Italian)",
 		"lt" => "Lietuvių (Lithuanian)",
 	);




More information about the Ros-diffs mailing list