git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c35037
)
Remove legacy api usage from comment.php
author
gggeek
<giunta.gaetano@gmail.com>
Sun, 19 Apr 2015 18:42:57 +0000
(19:42 +0100)
committer
gggeek
<giunta.gaetano@gmail.com>
Sun, 19 Apr 2015 18:42:57 +0000
(19:42 +0100)
demo/server/discuss.php
patch
|
blob
|
history
diff --git
a/demo/server/discuss.php
b/demo/server/discuss.php
index
2a137e8
..
b6b4659
100644
(file)
--- a/
demo/server/discuss.php
+++ b/
demo/server/discuss.php
@@
-2,23
+2,22
@@
include_once __DIR__ . "/../../vendor/autoload.php";
include_once __DIR__ . "/../../vendor/autoload.php";
-include_once __DIR__ . "/../../lib/xmlrpc.inc";
-include_once __DIR__ . "/../../lib/xmlrpcs.inc";
+use PhpXmlRpc\Value;
-$add
comment_sig = array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString,
$xmlrpcString));
+$add
Comment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString, Value::$xmlrpcString, Value::
$xmlrpcString));
-$add
c
omment_doc = 'Adds a comment to an item. The first parameter
+$add
C
omment_doc = 'Adds a comment to an item. The first parameter
is the item ID, the second the name of the commenter, and the third
is the comment itself. Returns the number of comments against that
ID.';
is the item ID, the second the name of the commenter, and the third
is the comment itself. Returns the number of comments against that
ID.';
-function add
c
omment($m)
+function add
C
omment($m)
{
{
- global $xmlrpcerruser;
$err = "";
// since validation has already been carried out for us,
// we know we got exactly 3 string values
$err = "";
// since validation has already been carried out for us,
// we know we got exactly 3 string values
- $n = php_xmlrpc_decode($m);
+ $encoder = new PhpXmlRpc\Encoder();
+ $n = $encoder->decode($m);
$msgID = $n[0];
$name = $n[1];
$comment = $n[2];
$msgID = $n[0];
$name = $n[1];
$comment = $n[2];
@@
-42,7
+41,7
@@
function addcomment($m)
}
// if we generated an error, create an error return response
if ($err) {
}
// if we generated an error, create an error return response
if ($err) {
- return new PhpXmlRpc\Response(0, $xmlrpcerruser, $err);
+ return new PhpXmlRpc\Response(0,
PhpXmlRpc\PhpXmlRpc::
$xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
// with the state name
} else {
// otherwise, we create the right response
// with the state name
@@
-50,15
+49,14
@@
function addcomment($m)
}
}
}
}
-$get
comments_sig = array(array($xmlrpcArray,
$xmlrpcString));
+$get
Comments_sig = array(array(Value::$xmlrpcArray, Value::
$xmlrpcString));
-$get
c
omments_doc = 'Returns an array of comments for a given ID, which
+$get
C
omments_doc = 'Returns an array of comments for a given ID, which
is the sole argument. Each array item is a struct containing name
and comment text.';
is the sole argument. Each array item is a struct containing name
and comment text.';
-function get
c
omments($m)
+function get
C
omments($m)
{
{
- global $xmlrpcerruser;
$err = "";
$ra = array();
$msgID = php_xmlrpc_decode($m->getParam(0));
$err = "";
$ra = array();
$msgID = php_xmlrpc_decode($m->getParam(0));
@@
-80,23
+78,24
@@
function getcomments($m)
}
// if we generated an error, create an error return response
if ($err) {
}
// if we generated an error, create an error return response
if ($err) {
- return new PhpXmlRpc\Response(0, $xmlrpcerruser, $err);
+ return new PhpXmlRpc\Response(0,
PhpXmlRpc\PhpXmlRpc::
$xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
// with the state name
} else {
// otherwise, we create the right response
// with the state name
- return new PhpXmlRpc\Response(php_xmlrpc_encode($ra));
+ $encoder = new PhpXmlRpc\Encoder();
+ return new PhpXmlRpc\Response($encoder->encode($ra));
}
}
$s = new PhpXmlRpc\Server(array(
"discuss.addComment" => array(
}
}
$s = new PhpXmlRpc\Server(array(
"discuss.addComment" => array(
- "function" => "add
c
omment",
- "signature" => $add
c
omment_sig,
- "docstring" => $add
c
omment_doc,
+ "function" => "add
C
omment",
+ "signature" => $add
C
omment_sig,
+ "docstring" => $add
C
omment_doc,
),
"discuss.getComments" => array(
),
"discuss.getComments" => array(
- "function" => "get
c
omments",
- "signature" => $get
c
omments_sig,
- "docstring" => $get
c
omments_doc,
+ "function" => "get
C
omments",
+ "signature" => $get
C
omments_sig,
+ "docstring" => $get
C
omments_doc,
),
));
),
));