Accept 'open' and 'closed' as valid values for mt_allow_comments and mt_allow_pings in XML-RPC. Props Joseph Scott. see #4469

git-svn-id: http://svn.automattic.com/wordpress/trunk@5729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-06-19 19:12:24 +00:00
parent 7b09e504e7
commit 7ffc5ee8b0
1 changed files with 114 additions and 24 deletions

View File

@ -994,31 +994,67 @@ class wp_xmlrpc_server extends IXR_Server {
$post_more = $content_struct['mt_text_more']; $post_more = $content_struct['mt_text_more'];
if(isset($content_struct["mt_allow_comments"])) { if(isset($content_struct["mt_allow_comments"])) {
switch((int) $content_struct["mt_allow_comments"]) { if(!is_numeric($content_struct["mt_allow_comments"])) {
case 0: switch($content_struct["mt_allow_comments"]) {
$comment_status = "closed"; case "closed":
break; $comment_status = "closed";
case 1: break;
$comment_status = "open"; case "open":
break; $comment_status = "open";
default: break;
$comment_status = get_option("default_comment_status"); default:
break; $comment_status = get_option("default_comment_status");
break;
}
} }
else {
switch((int) $content_struct["mt_allow_comments"]) {
case 0:
$comment_status = "closed";
break;
case 1:
$comment_status = "open";
break;
default:
$comment_status = get_option("default_comment_status");
break;
}
}
}
else {
$comment_status = get_option("default_comment_status");
} }
if(isset($content_struct["mt_allow_pings"])) { if(isset($content_struct["mt_allow_pings"])) {
switch((int) $content_struct["mt_allow_pings"]) { if(!is_numeric($content_struct["mt_allow_pings"])) {
case 0: switch($content["mt_allow_pings"]) {
$ping_status = "closed"; case "closed":
break; $ping_status = "closed";
case 1: break;
$ping_status = "open"; case "open":
break; $ping_status = "open";
default: break;
$ping_status = get_option("default_ping_status"); default:
break; $ping_status = get_option("default_ping_status");
break;
}
} }
else {
switch((int) $content_struct["mt_allow_pings"]) {
case 0:
$ping_status = "closed";
break;
case 1:
$ping_status = "open";
break;
default:
$ping_status = get_option("default_ping_status");
break;
}
}
}
else {
$ping_status = get_option("default_ping_status");
} }
if ($post_more) { if ($post_more) {
@ -1170,6 +1206,64 @@ class wp_xmlrpc_server extends IXR_Server {
$post_author = $content_struct["wp_author_id"]; $post_author = $content_struct["wp_author_id"];
} }
if(isset($content_struct["mt_allow_comments"])) {
if(!is_numeric($content_struct["mt_allow_comments"])) {
switch($content_struct["mt_allow_comments"]) {
case "closed":
$comment_status = "closed";
break;
case "open":
$comment_status = "open";
break;
default:
$comment_status = get_option("default_comment_status");
break;
}
}
else {
switch((int) $content_struct["mt_allow_comments"]) {
case 0:
$comment_status = "closed";
break;
case 1:
$comment_status = "open";
break;
default:
$comment_status = get_option("default_comment_status");
break;
}
}
}
if(isset($content_struct["mt_allow_pings"])) {
if(!is_numeric($content_struct["mt_allow_pings"])) {
switch($content["mt_allow_pings"]) {
case "closed":
$ping_status = "closed";
break;
case "open":
$ping_status = "open";
break;
default:
$ping_status = get_option("default_ping_status");
break;
}
}
else {
switch((int) $content_struct["mt_allow_pings"]) {
case 0:
$ping_status = "closed";
break;
case 1:
$ping_status = "open";
break;
default:
$ping_status = get_option("default_ping_status");
break;
}
}
}
// Only set ping_status if it was provided. // Only set ping_status if it was provided.
if(isset($content_struct["mt_allow_pings"])) { if(isset($content_struct["mt_allow_pings"])) {
switch((int) $content_struct["mt_allow_pings"]) { switch((int) $content_struct["mt_allow_pings"]) {
@ -1213,10 +1307,6 @@ class wp_xmlrpc_server extends IXR_Server {
if ( is_array($to_ping) ) if ( is_array($to_ping) )
$to_ping = implode(' ', $to_ping); $to_ping = implode(' ', $to_ping);
if(isset($content_struct["mt_allow_comments"])) {
$comment_status = (int) $content_struct["mt_allow_comments"];
}
// Do some timestamp voodoo // Do some timestamp voodoo
$dateCreatedd = $content_struct['dateCreated']; $dateCreatedd = $content_struct['dateCreated'];
if (!empty($dateCreatedd)) { if (!empty($dateCreatedd)) {