"; exit(); } function dispatch($client, $method, $args) { $req = new PhpXmlRpc\Request($method, $args); $resp = $client->send($req); if (!$resp) { print "
IO error: " . $client->errstr . "
"; bomb(); } if ($resp->faultCode()) { print "There was an error: " . $resp->faultCode() . " " . $resp->faultString() . "
"; bomb(); } $encoder = new PhpXmlRpc\Encoder(); return $encoder->decode($resp->value()); } // create client for discussion server $dclient = new PhpXmlRpc\Client("http://xmlrpc.usefulinc.com/${mydir}discuss.php"); // check if we're posting a comment, and send it if so @$storyid = $_POST["storyid"]; if ($storyid) { // print "Returning to " . $HTTP_POST_VARS["returnto"]; $res = dispatch($dclient, "discuss.addComment", array(new PhpXmlRpc\Value($storyid), new PhpXmlRpc\Value(stripslashes(@$_POST["name"])), new PhpXmlRpc\Value(stripslashes(@$_POST["commenttext"])),)); // send the browser back to the originating page Header("Location: ${mydir}/comment.php?catid=" . $_POST["catid"] . "&chanid=" . $_POST["chanid"] . "&oc=" . $_POST["catid"]); exit(0); } // now we've got here, we're exploring the story store ?>" . $v['title'] . " "; print $v['description'] . " "; print "Read full story "; print "Comment on this story"; print ""; print " | ";
print "\n";
// now look for existing comments
$res = dispatch($dclient, "discuss.getComments",
array(new PhpXmlRpc\Value($v['id'])));
if (sizeof($res) > 0) {
print "
" . "Comments on this story: "; for ($i = 0; $i < sizeof($res); $i++) { $s = $res[$i]; print "From: " . htmlentities($s['name']) . " |