Make WordPress Core

Changeset 5730


Ignore:
Timestamp:
06/19/2007 07:37:05 PM (19 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/xmlrpc.php

    r5722 r5730  
    10011001
    10021002                if(isset($content_struct["mt_allow_comments"])) {
    1003                         switch((int) $content_struct["mt_allow_comments"]) {
    1004                                 case 0:
    1005                                         $comment_status = "closed";
    1006                                         break;
    1007                                 case 1:
    1008                                         $comment_status = "open";
    1009                                         break;
    1010                                 default:
    1011                                         $comment_status = get_option("default_comment_status");
    1012                                         break;
     1003                        if(!is_numeric($content_struct["mt_allow_comments"])) {
     1004                                switch($content_struct["mt_allow_comments"]) {
     1005                                        case "closed":
     1006                                                $comment_status = "closed";
     1007                                                break;
     1008                                        case "open":
     1009                                                $comment_status = "open";
     1010                                                break;
     1011                                        default:
     1012                                                $comment_status = get_option("default_comment_status");
     1013                                                break;
     1014                                }
    10131015                        }
     1016                        else {
     1017                                switch((int) $content_struct["mt_allow_comments"]) {
     1018                                        case 0:
     1019                                                $comment_status = "closed";
     1020                                                break;
     1021                                        case 1:
     1022                                                $comment_status = "open";
     1023                                                break;
     1024                                        default:
     1025                                                $comment_status = get_option("default_comment_status");
     1026                                                break;
     1027                                }
     1028                        }
     1029                }
     1030                else {
     1031                        $comment_status = get_option("default_comment_status");
    10141032                }
    10151033
    10161034                if(isset($content_struct["mt_allow_pings"])) {
    1017                         switch((int) $content_struct["mt_allow_pings"]) {
    1018                                 case 0:
    1019                                         $ping_status = "closed";
    1020                                         break;
    1021                                 case 1:
    1022                                         $ping_status = "open";
    1023                                         break;
    1024                                 default:
    1025                                         $ping_status = get_option("default_ping_status");
    1026                                         break;
     1035                        if(!is_numeric($content_struct["mt_allow_pings"])) {
     1036                                switch($content["mt_allow_pings"]) {
     1037                                        case "closed":
     1038                                                $ping_status = "closed";
     1039                                                break;
     1040                                        case "open":
     1041                                                $ping_status = "open";
     1042                                                break;
     1043                                        default:
     1044                                                $ping_status = get_option("default_ping_status");
     1045                                                break;
     1046                                }
    10271047                        }
     1048                        else {
     1049                                switch((int) $content_struct["mt_allow_pings"]) {
     1050                                        case 0:
     1051                                                $ping_status = "closed";
     1052                                                break;
     1053                                        case 1:
     1054                                                $ping_status = "open";
     1055                                                break;
     1056                                        default:
     1057                                                $ping_status = get_option("default_ping_status");
     1058                                                break;
     1059                                }
     1060                        }
     1061                }
     1062                else {
     1063                        $ping_status = get_option("default_ping_status");
    10281064                }
    10291065
    … …  
    11791215                }
    11801216
    1181                 // Only set ping_status if it was provided.
     1217                if(isset($content_struct["mt_allow_comments"])) {
     1218                        if(!is_numeric($content_struct["mt_allow_comments"])) {
     1219                                switch($content_struct["mt_allow_comments"]) {
     1220                                        case "closed":
     1221                                                $comment_status = "closed";
     1222                                                break;
     1223                                        case "open":
     1224                                                $comment_status = "open";
     1225                                                break;
     1226                                        default:
     1227                                                $comment_status = get_option("default_comment_status");
     1228                                                break;
     1229                                }
     1230                        }
     1231                        else {
     1232                                switch((int) $content_struct["mt_allow_comments"]) {
     1233                                        case 0:
     1234                                                $comment_status = "closed";
     1235                                                break;
     1236                                        case 1:
     1237                                                $comment_status = "open";
     1238                                                break;
     1239                                        default:
     1240                                                $comment_status = get_option("default_comment_status");
     1241                                                break;
     1242                                }
     1243                        }
     1244                }
     1245
    11821246                if(isset($content_struct["mt_allow_pings"])) {
    1183                         switch((int) $content_struct["mt_allow_pings"]) {
    1184                                 case 0:
    1185                                         $ping_status = "closed";
    1186                                         break;
    1187                                 case 1:
    1188                                         $ping_status = "open";
    1189                                         break;
     1247                        if(!is_numeric($content_struct["mt_allow_pings"])) {
     1248                                switch($content["mt_allow_pings"]) {
     1249                                        case "closed":
     1250                                                $ping_status = "closed";
     1251                                                break;
     1252                                        case "open":
     1253                                                $ping_status = "open";
     1254                                                break;
     1255                                        default:
     1256                                                $ping_status = get_option("default_ping_status");
     1257                                                break;
     1258                                }
     1259                        }
     1260                        else {
     1261                                switch((int) $content_struct["mt_allow_pings"]) {
     1262                                        case 0:
     1263                                                $ping_status = "closed";
     1264                                                break;
     1265                                        case 1:
     1266                                                $ping_status = "open";
     1267                                                break;
     1268                                        default:
     1269                                                $ping_status = get_option("default_ping_status");
     1270                                                break;
     1271                                }
    11901272                        }
    11911273                }
    … …  
    12221304                $to_ping = implode(' ', $to_ping);
    12231305
    1224       if(isset($content_struct["mt_allow_comments"])) {
    1225                 $comment_status = (int) $content_struct["mt_allow_comments"];
    1226       }
    1227          
    12281306          // Do some timestamp voodoo
    12291307          $dateCreatedd = $content_struct['dateCreated'];
Note: See TracChangeset for help on using the changeset viewer.