mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-20 16:42:59 +02:00
- ws accepts method name in GET paraeters even if http method is POST (easier to see in apache logs)
- picture rating is done through POST and not GET git-svn-id: http://piwigo.org/svn/trunk@11834 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -41,6 +41,10 @@ class PwgRestRequestHandler
|
||||
$params[$name]=$value;
|
||||
}
|
||||
}
|
||||
if ( empty($method) && isset($_GET['method']) )
|
||||
{
|
||||
$method = $_GET['method'];
|
||||
}
|
||||
|
||||
if ( empty($method) )
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ function updateRating(e)
|
||||
y.callService(
|
||||
"pwg.images.rate", {image_id: gRatingOptions.image_id, rate: rateButton.initialRateValue } ,
|
||||
{
|
||||
method: "POST",
|
||||
onFailure: function(num, text) {
|
||||
alert(num + " " + text);
|
||||
document.location = rateButton.form.action + "&rate="+rateButton.initialRateValue;
|
||||
|
||||
@@ -60,9 +60,9 @@ PwgWS.prototype = {
|
||||
}
|
||||
this.xhr.onreadystatechange = pwgBind(this, this.onStateChange);
|
||||
|
||||
var url = this.urlRoot+"ws.php?format=json";
|
||||
var url = this.urlRoot+"ws.php?format=json&method="+method;
|
||||
|
||||
var body = "method="+method;
|
||||
var body = "";
|
||||
if (parameters)
|
||||
{
|
||||
for (var prop in parameters)
|
||||
@@ -70,10 +70,10 @@ PwgWS.prototype = {
|
||||
if ( typeof parameters[prop] == 'object' && parameters[prop])
|
||||
{
|
||||
for (var i=0; i<parameters[prop].length; i++)
|
||||
body += "&"+prop+"[]="+encodeURIComponent(parameters[prop][i]);
|
||||
body += prop+"[]="+encodeURIComponent(parameters[prop][i])+"&";
|
||||
}
|
||||
else
|
||||
body += "&"+prop+"="+encodeURIComponent(parameters[prop]);
|
||||
body += prop+"="+encodeURIComponent(parameters[prop])+"&";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user