Commit 4a0e498f authored by Dries's avatar Dries

- a batch of updates, including some experimental changes to the moderation
  of comments and nodes.
parent 6cde6329
......@@ -10,33 +10,29 @@
$corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high", 4 => "Rate - low");
class Comment {
function Comment($uid, $name, $subject, $comment, $timestamp, $url, $score, $votes, $cid, $lid) {
function Comment($uid, $name, $subject, $comment, $timestamp, $url, $cid, $lid) {
$this->uid = $uid;
$this->name = $name;
$this->subject = $subject;
$this->comment = $comment;
$this->timestamp = $timestamp;
$this->url = $url;
$this->score = $score;
$this->votes = $votes;
$this->cid = $cid;
$this->lid = $lid;
}
}
function comment_moderate($moderate) {
global $user, $comment_votes;
global $user;
if ($user->uid && $moderate) {
$none = $comment_votes[key($comment_votes)];
foreach ($moderate as $id=>$vote) {
if ($vote != $comment_votes[$none]) {
$id = check_output($id);
$vote = check_output($vote);
$comment = db_fetch_object(db_query("SELECT * FROM comments WHERE cid = '$id'"));
if ($comment && !field_get($comment->users, $user->uid)) {
$result = db_query("UPDATE comments SET score = score $vote, votes = votes + 1, users = '". field_set($comment->users, $user->uid, $vote) ."' WHERE cid = '$id'");
foreach ($moderate as $cid => $score) {
if ($score > 0 && $score < 6) {
if (db_fetch_object(db_query("SELECT * FROM moderate WHERE uid = '". check_query($user->uid) ."' AND cid = '". check_query($cid) ."'"))) {
db_query("UPDATE moderate SET score = '". check_query($score) ."' WHERE uid = '". check_query($user->uid) ."' AND cid = '". check_query($cid) ."'");
}
else {
db_query("INSERT INTO moderate (uid, cid, score, timestamp) VALUES ('". check_query($user->uid) ."', '". check_query($cid) ."', '". check_query($score) ."', '". time() ."')");
}
}
}
......@@ -83,7 +79,7 @@ function comment_reply($pid, $id) {
if ($pid) {
$item = db_fetch_object(db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.cid = '$pid'"));
comment_view(new Comment($item->uid, $item->name, $item->subject, $item->comment, $item->timestamp, $item->url, comment_score($comment), $comment->votes, $item->cid, $item->lid), t("reply to this comment"));
comment_view(new Comment($item->uid, $item->name, $item->subject, $item->comment, $item->timestamp, $item->url, $item->cid, $item->lid), t("reply to this comment"));
}
else {
node_view(node_get_object(array("nid" => $id)));
......@@ -128,7 +124,7 @@ function comment_post($edit) {
watchdog("special", "comment: added '$edit[subject]'");
// add comment to database:
db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('". check_input($edit[id]) ."', '". check_input($edit[pid]) ."', '$user->uid', '". check_input($edit[subject]) ."', '". check_input($edit[comment]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->name ? 1 : 0) ."')");
db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp) VALUES ('". check_input($edit[id]) ."', '". check_input($edit[pid]) ."', '$user->uid', '". check_input($edit[subject]) ."', '". check_input($edit[comment]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')");
// clear cache:
cache_clear();
......@@ -136,96 +132,112 @@ function comment_post($edit) {
}
}
function comment_score($comment) {
$value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0);
return ((strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00");
}
function comment_num_replies($id, $count = 0) {
$result = db_query("SELECT COUNT(cid) FROM comments WHERE pid = '$id'");
return ($result) ? db_result($result, 0) : 0;
}
function comment_moderation($comment) {
global $comment_votes, $op, $user;
global $user;
if ($op == "reply") {
// preview comment:
$output .= "&nbsp;";
}
else if ($user->uid && $user->name != $comment->name && !field_get($comment->users, $user->uid)) {
// comment hasn't been moderated yet:
foreach ($comment_votes as $key=>$value) $options .= " <OPTION VALUE=\"$value\">$key</OPTION>\n";
$output .= "<SELECT NAME=\"moderate[$comment->cid]\">$options</SELECT>\n";
}
else {
// comment has already been moderated:
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\"><TR><TD ALIGN=\"right\">". t("score") .":</TD><TD>". check_output($comment->score) ."</TD></TR><TR><TD ALIGN=\"right\">". t("votes") .":</TD><TD>". check_output($comment->votes) ."</TD></TR></TABLE>\n";
$values = array("--", 1, 2, 3, 4, 5);
$moderate = db_fetch_object(db_query("SELECT * FROM moderate WHERE cid = '$comment->cid' AND uid = '$user->uid'"));
foreach ($values as $key => $value) {
$options .= " <option value=\"$key\"". ($moderate->score == $key ? " selected=\"selected\"" : "") .">$value</option>\n";
}
$output .= "<div align=\"center\">";
$output .= " <select name=\"moderate[comment][$comment->cid]\">$options</select><br />". ($comment->score ? $comment->score : "--") ." / $comment->votes";
$output .= "</div>";
return $output;
}
function comment_threshold($threshold) {
for ($i = -1; $i < 6; $i++) $options .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">". t("Filter") ." - $i</OPTION>";
return "<SELECT NAME=\"threshold\">$options</SELECT>\n";
for ($i = 0; $i < 6; $i++) $options .= " <option value=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">". t("Visibility") ." - $i</option>";
return "<select name=\"threshold\">$options</select>\n";
}
function comment_mode($mode) {
global $cmodes;
foreach ($cmodes as $key=>$value) $options .= " <OPTION VALUE=\"$key\"". ($mode == $key ? " SELECTED" : "") .">$value</OPTION>\n";
return "<SELECT NAME=\"mode\">$options</SELECT>\n";
foreach ($cmodes as $key=>$value) $options .= " <option value=\"$key\"". ($mode == $key ? " SELECTED" : "") .">$value</option>\n";
return "<select name=\"mode\">$options</select>\n";
}
function comment_order($order) {
global $corder;
foreach ($corder as $key=>$value) $options .= " <OPTION VALUE=\"$key\"". ($order == $key ? " SELECTED" : "") .">$value</OPTION>\n";
return "<SELECT NAME=\"order\">$options</SELECT>\n";
foreach ($corder as $key=>$value) $options .= " <option value=\"$key\"". ($order == $key ? " SELECTED" : "") .">$value</option>\n";
return "<select name=\"order\">$options</select>\n";
}
function comment_query($lid, $order, $pid = -1) {
$query .= "SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.lid = '$lid'";
if ($pid >= 0) $query .= " AND pid = '$pid'";
if ($order == 1) $query .= " ORDER BY c.timestamp DESC";
else if ($order == 2) $query .= " ORDER BY c.timestamp";
else if ($order == 3) $query .= " ORDER BY c.score DESC";
else if ($order == 4) $query .= " ORDER BY c.score";
$query .= "SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'";
if ($pid >= 0) {
$query .= " AND pid = '$pid'";
}
$query .= " GROUP BY c.cid";
if ($order == 1) {
$query .= " ORDER BY c.timestamp DESC";
}
else if ($order == 2) {
$query .= " ORDER BY c.timestamp";
}
else if ($order == 3) {
$query .= " ORDER BY score DESC";
}
else if ($order == 4) {
$query .= " ORDER BY score";
}
return db_query($query);
}
function comment_visible($comment, $threshold = 0) {
if ($comment->votes == 0 && $comment->score >= $threshold) return 1;
else if ($comment->votes > 0 && $comment->score / $comment->votes >= $threshold) return 1;
else return 0;
}
function comment_uri($args = 0) {
global $mod;
if ($args) return ($mod) ? "module.php?mod=$mod;$args" : "node.php?$args";
else return ($mod) ? "module.php?mod=$mod" : "node.php";
function comment_visible($comment, $threshold = 0) {
if ($comment->votes == 0 || $comment->score >= $threshold) {
return 1;
}
else {
return 0;
}
}
function comment_links($comment, $return = 1) {
global $theme;
if ($return) return "<A HREF=\"". comment_uri("id=$comment->lid#$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("return") ."</FONT></A> | <A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("reply to this comment") ."</FONT></A>";
else return "<A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("reply to this comment") ."</FONT></A>";
if ($return) {
return "<a href=\"node.php?id=$comment->lid#$comment->cid\"><font color=\"$theme->type\">". t("return") ."</font></a> | <a href=\"node.php?op=reply&id=$comment->lid&pid=$comment->cid\"><font color=\"$theme->type\">". t("reply to this comment") ."</font></a>";
}
else {
return "<a href=\"node.php?op=reply&id=$comment->lid&pid=$comment->cid\"><font color=\"$theme->type\">". t("reply to this comment") ."</font></a>";
}
}
function comment_view($comment, $folded = 0) {
global $theme;
// calculate comment's score:
$comment->score = comment_score($comment);
// display comment:
if ($folded) $theme->comment($comment, $folded);
else print "<A HREF=\"". comment_uri("id=$comment->lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ."</A> by ". format_name($comment) ." <SMALL>($comment->score)</SMALL><P>";
if ($folded) {
$theme->comment($comment, $folded);
}
else {
print "<a href=\"node.php?id=$comment->lid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a> by ". format_name($comment) ." <small>(". ($comment->score ? $comment->score : "--") ." / $comment->votes)</small><p />";
}
}
function comment_thread_min($cid, $threshold) {
global $user;
$result = db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.pid = '$cid' ORDER BY c.timestamp, c.cid");
$result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
while ($comment = db_fetch_object($result)) {
print "<ul>";
......@@ -239,15 +251,15 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
global $user;
/*
** We had quite a few browser specific issues with expanded comments below
** the top level getting truncated on the right hand side. A range of
** solutions have been suggested and tried but either the right margins of
** the comments didn't line up as well, or the heavily nested tables made
** for slow rendering and cluttered HTML. This is the best work-around in
** terms of speed and size.
** We had quite a few browser specific issues: expanded comments below
** the top level got truncated on the right hand side. A range of
** solutions have been proposed and tried but either the right margins of
** the comments didn't line up well, or the heavily nested tables made
** for slow rendering and cluttered HTML. This is the best work-around
** in terms of speed and size.
*/
$result = db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.pid = '$cid' ORDER BY c.timestamp, c.cid");
$result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
while ($comment = db_fetch_object($result)) {
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td width=\"". ($level * 25) ."\">&nbsp;</td><td>\n";
......@@ -265,7 +277,7 @@ function comment_render($lid, $cid) {
if (user_access("access comments")) {
/*
** pre-process variables:
** Pre-process variables:
*/
if (empty($lid)) {
......@@ -273,7 +285,7 @@ function comment_render($lid, $cid) {
}
if (empty($cid)) {
$cide = 0;
$cid = 0;
}
if (empty($mode)) {
......@@ -288,19 +300,17 @@ function comment_render($lid, $cid) {
$threshold = $user->uid ? $user->threshold : variable_get(default_comment_threshold, 3);
}
print "<form method=\"post\" action=\"$REQUEST_URI\">\n";
// print " <INPUT TYPE=\"hidden\" NAME=\"id\" value=\"$lid\">\n";
/*
** Render comment control:
** Render control panel:
*/
$theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order));
if ($user->uid) {
// Print moderation form:
print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n";
}
$theme->box(t("Control panel"), $theme->comment_controls($threshold, $mode, $order));
if ($cid > 0) {
$result = db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE cid = '$cid'");
$result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.cid = '$cid' GROUP BY c.cid");
if ($comment = db_fetch_object($result)) {
comment_view($comment, comment_links($comment));
}
......@@ -308,14 +318,14 @@ function comment_render($lid, $cid) {
else {
if ($mode == 1) {
$result = comment_query($lid, $order);
print "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
print " <TR><TH>Subject</TH><TH>Author</TH><TH>Date</TH><TH>Score</TH></TR>\n";
print "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
print " <tr><th>Subject</th><th>Author</th><th>Date</th><th>Score</th></tr>\n";
while ($comment = db_fetch_object($result)) {
if (comment_visible($comment, $threshold)) {
print " <TR><TD><A HREF=\"". comment_uri("id=$comment->lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ."</A></TD><TD>". format_name($comment) ."</TD><TD>". format_date($comment->timestamp, "small") ."</TD><TD>". comment_score($comment) ."</TD></TR>\n";
print " <tr><td><a href=\"node.php?id=$comment->lid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a></td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
}
}
print "</TABLE>\n";
print "</table>\n";
}
else if ($mode == 2) {
$result = comment_query($lid, $order);
......@@ -339,12 +349,8 @@ function comment_render($lid, $cid) {
}
}
if ($user->uid) {
// Print moderation form:
print " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$lid\">\n";
print " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Moderate comments") ."\">\n";
print "</FORM>\n";
}
print "</form>";
}
}
......
......@@ -8,22 +8,6 @@
$db_pass = "drop"; // password
$db_name = "database"; // database
#
# Comment votes:
# The keys of this associative array are displayed in each comment's
# selection box whereas the corresponding values represent the
# mathematical calculation to be performed to update a comment's
# value.
#
$comment_votes = array("none" => "none",
"-1" => "- 1",
"0" => "+ 0",
"+1" => "+ 1",
"+2" => "+ 2",
"+3" => "+ 3",
"+4" => "+ 4",
"+5" => "+ 5");
#
# Themes:
#
......
......@@ -4,7 +4,10 @@
$rstatus = array(0 => dumped, 1 => expired, 2 => queued, 3 => posted);
function _node_get($conditions) {
foreach ($conditions as $key=>$value) $cond[] = "n.". check_query($key) ." = '". check_query($value) ."'";
foreach ($conditions as $key=>$value) {
$cond[] = "n.". check_query($key) ." = '". check_query($value) ."'";
}
$where = implode(" AND ", $cond);
if ($conditions[type]) {
......@@ -16,7 +19,7 @@ function _node_get($conditions) {
}
if ($type) {
return db_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC");
return db_query("SELECT n.*, l.*, u.uid, u.name, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid ORDER BY n.timestamp DESC");
}
}
......@@ -267,7 +270,8 @@ function node_moderation($nid) {
$options .= " <option value=\"$key\"". ($moderate->score == $key ? " selected=\"selected\"" : "") .">$value</option>\n";
}
$output .= " <select name=\"moderate[node][$node->nid]\">$options</select> (". ($node->score ? $node->score : "--") ." / $node->votes)";
$output .= "accumulated rating: ". ($node->score ? $node->score : "--") ." / $node->votes<br />";
$output .= "<select name=\"moderate[node][$node->nid]\">$options</select>";
return $output;
}
......
......@@ -10,16 +10,18 @@ function image($name) {
}
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $REQUEST_URI, $user;
$output .= "<DIV ALIGN=\"CENTER\">\n";
$output .= "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n";
$output .= comment_mode(($user->uid ? $user->mode : $mode));
$output .= comment_order(($user->uid ? $user->sort : $order));
$output .= comment_threshold(($user->uid ? $user->threshold : $threshold));
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Update settings") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Add comment") ."\">\n";
$output .= "</FORM>\n";
$output .= "</DIV>\n";
global $user, $id;
if ($user->uid) {
$output .= form_item(t("Node rating"), node_moderation($id) ." <input type=\"submit\" name=\"op\" value=\"". t("Update ratings") ."\" />", t("Nodes and comments can be moderated by assigning them a score: content with a high rating is made more visible."));
}
$output .= form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
if (user_access("post comment")) {
$output .= form_item(t("Add a comment"), "<input type=\"submit\" name=\"op\" value=\"". t("Add comment") ."\" />", t("Click 'Add comment' to start a new thread in the discussion."));
}
return $output;
}
......
This diff is collapsed.
......@@ -39,265 +39,265 @@
// requires: xmlrpc.inc
// listMethods: either a string, or nothing
$_xmlrpcs_listMethods_sig=array(array($xmlrpcArray, $xmlrpcString),
array($xmlrpcArray));
$_xmlrpcs_listMethods_sig=array(array($xmlrpcArray, $xmlrpcString),
array($xmlrpcArray));
$_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
function _xmlrpcs_listMethods($server, $m) {
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
$v=new xmlrpcval();
$dmap=$server->dmap;
$outAr=array();
for(reset($dmap); list($key, $val)=each($dmap); ) {
$outAr[]=new xmlrpcval($key, "string");
}
$dmap=$_xmlrpcs_dmap;
for(reset($dmap); list($key, $val)=each($dmap); ) {
$outAr[]=new xmlrpcval($key, "string");
}
$v->addArray($outAr);
return new xmlrpcresp($v);
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
$v=new xmlrpcval();
$dmap=$server->dmap;
$outAr=array();
for(reset($dmap); list($key, $val)=each($dmap); ) {
$outAr[]=new xmlrpcval($key, "string");
}
$dmap=$_xmlrpcs_dmap;
for(reset($dmap); list($key, $val)=each($dmap); ) {
$outAr[]=new xmlrpcval($key, "string");
}
$v->addArray($outAr);
return new xmlrpcresp($v);
}
$_xmlrpcs_methodSignature_sig=array(array($xmlrpcArray, $xmlrpcString));
$_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
function _xmlrpcs_methodSignature($server, $m) {
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
$methName=$m->getParam(0);
$methName=$methName->scalarval();
if (ereg("^system\.", $methName)) {
$dmap=$_xmlrpcs_dmap; $sysCall=1;
} else {
$dmap=$server->dmap; $sysCall=0;
}
// print "<!-- ${methName} -->\n";
if (isset($dmap[$methName])) {
if ($dmap[$methName]["signature"]) {
$sigs=array();
$thesigs=$dmap[$methName]["signature"];
for($i=0; $i<sizeof($thesigs); $i++) {
$cursig=array();
$inSig=$thesigs[$i];
for($j=0; $j<sizeof($inSig); $j++) {
$cursig[]=new xmlrpcval($inSig[$j], "string");
}
$sigs[]=new xmlrpcval($cursig, "array");
}
$r=new xmlrpcresp(new xmlrpcval($sigs, "array"));
} else {
$r=new xmlrpcresp(new xmlrpcval("undef", "string"));
}
} else {
$r=new xmlrpcresp(0,
$xmlrpcerr["introspect_unknown"],
$xmlrpcstr["introspect_unknown"]);
}
return $r;
$methName=$m->getParam(0);
$methName=$methName->scalarval();
if (ereg("^system\.", $methName)) {
$dmap=$_xmlrpcs_dmap; $sysCall=1;
} else {
$dmap=$server->dmap; $sysCall=0;
}
// print "<!-- ${methName} -->\n";
if (isset($dmap[$methName])) {
if ($dmap[$methName]["signature"]) {
$sigs=array();
$thesigs=$dmap[$methName]["signature"];
for($i=0; $i<sizeof($thesigs); $i++) {
$cursig=array();
$inSig=$thesigs[$i];
for($j=0; $j<sizeof($inSig); $j++) {
$cursig[]=new xmlrpcval($inSig[$j], "string");
}
$sigs[]=new xmlrpcval($cursig, "array");
}
$r=new xmlrpcresp(new xmlrpcval($sigs, "array"));
} else {
$r=new xmlrpcresp(new xmlrpcval("undef", "string"));
}
} else {
$r=new xmlrpcresp(0,
$xmlrpcerr["introspect_unknown"],
$xmlrpcstr["introspect_unknown"]);
}
return $r;
}
$_xmlrpcs_methodHelp_sig=array(array($xmlrpcString, $xmlrpcString));
$_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
function _xmlrpcs_methodHelp($server, $m) {
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
$methName=$m->getParam(0);
$methName=$methName->scalarval();
if (ereg("^system\.", $methName)) {
$dmap=$_xmlrpcs_dmap; $sysCall=1;
} else {
$dmap=$server->dmap; $sysCall=0;
}
// print "<!-- ${methName} -->\n";
if (isset($dmap[$methName])) {
if ($dmap[$methName]["docstring"]) {
$r=new xmlrpcresp(new xmlrpcval($dmap[$methName]["docstring"]),
"string");
} else {
$r=new xmlrpcresp(new xmlrpcval("", "string"));
}
} else {
$r=new xmlrpcresp(0,
$xmlrpcerr["introspect_unknown"],
$xmlrpcstr["introspect_unknown"]);
}
return $r;
$methName=$m->getParam(0);
$methName=$methName->scalarval();
if (ereg("^system\.", $methName)) {
$dmap=$_xmlrpcs_dmap; $sysCall=1;
} else {
$dmap=$server->dmap; $sysCall=0;
}
// print "<!-- ${methName} -->\n";
if (isset($dmap[$methName])) {
if ($dmap[$methName]["docstring"]) {
$r=new xmlrpcresp(new xmlrpcval($dmap[$methName]["docstring"]),
"string");
} else {
$r=new xmlrpcresp(new xmlrpcval("", "string"));
}
} else {
$r=new xmlrpcresp(0,
$xmlrpcerr["introspect_unknown"],
$xmlrpcstr["introspect_unknown"]);
}
return $r;
}
$_xmlrpcs_dmap=array(
"system.listMethods" =>
array("function" => "_xmlrpcs_listMethods",
"signature" => $_xmlrpcs_listMethods_sig,
"docstring" => $_xmlrpcs_listMethods_doc),
"system.methodHelp" =>
array("function" => "_xmlrpcs_methodHelp",
"signature" => $_xmlrpcs_methodHelp_sig,
"docstring" => $_xmlrpcs_methodHelp_doc),
"system.methodSignature" =>
array("function" => "_xmlrpcs_methodSignature",
"signature" => $_xmlrpcs_methodSignature_sig,
"docstring" => $_xmlrpcs_methodSignature_doc)
);
"system.listMethods" =>
array("function" => "_xmlrpcs_listMethods",
"signature" => $_xmlrpcs_listMethods_sig,
"docstring" => $_xmlrpcs_listMethods_doc),
"system.methodHelp" =>
array("function" => "_xmlrpcs_methodHelp",
"signature" => $_xmlrpcs_methodHelp_sig,
"docstring" => $_xmlrpcs_methodHelp_doc),