2014-04-14 9:05 GMT+02:00 Michal Čihař michal@cihar.com:
Hi
Dne Sun, 13 Apr 2014 15:30:57 +0200 Hugues Peccatte hugues.peccatte@gmail.com napsal(a):
I'm working on bug ticket http://sourceforge.net/p/phpmyadmin/bugs/3733/ I already replaced all & in PHP files by the separator defined in
php.ini.
I also replaced a part of & in JS files (almost all). But I still have an issue... with Jquery method $.get...
This method have many parameters, and one could be a JSON object of URL parameters. Something like this: var params = { aPath: $expandElem.find('span.aPath').text(), vPath: $expandElem.find('span.vPath').text() }; And this: $.get(url, params, function (data) { ... });
It seems to be hardcoded within jQuery.param(). On the other side, if you give jQuery.get() a string as a params, it will use it as it is. So we can introduce our own function to do the array to string conversion, which will use correct separator, something like (completely not tested):
function PMA_URL_params(params) { var s = []; $.each(params, function() { s[s.length] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); });
return s.join(SEPARATOR);
}
$.get(url, PMA_URL_params(params), function (data) { ... });
-- Michal Čihař | http://cihar.com | http://phpmyadmin.net
Hi,
I was looking for something more implicit, so we wouldn't have to change the calls to $.get. But that seems to be difficult, so your solution might be the best. I just suggest this: function PMA_URL_params(params) { var s = ['']; //Set with an empty element, so the join will start with a SEPARATOR char. If params is empty, the return would be an empty string. $.each(params, function() { s[s.length] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }); return s.join(SEPARATOR); }
//Give a URL with all parameters, not the URL and another parameter with the GET parameters. Why? Because of the Jquery concatenation that would concat URL and params with a &. $.get(url + PMA_URL_params(params), function (data) { ... });
Is it ok for you ?
Hugues.