Changeset 5729

Show
Ignore:
Timestamp:
06/19/07 19:12:24 (1 year 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. see #4469

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xmlrpc.php

    r5721 r5729  
    995995 
    996996        if(isset($content_struct["mt_allow_comments"])) { 
    997             switch((int) $content_struct["mt_allow_comments"]) { 
    998                 case 0: 
    999                     $comment_status = "closed"; 
    1000                     break; 
    1001                 case 1: 
    1002                     $comment_status = "open"; 
    1003                     break; 
    1004                 default: 
    1005                     $comment_status = get_option("default_comment_status"); 
    1006                     break; 
     997            if(!is_numeric($content_struct["mt_allow_comments"])) { 
     998                switch($content_struct["mt_allow_comments"]) { 
     999                    case "closed": 
     1000                        $comment_status = "closed"; 
     1001                        break; 
     1002                    case "open": 
     1003                        $comment_status = "open"; 
     1004                        break; 
     1005                    default: 
     1006                        $comment_status = get_option("default_comment_status"); 
     1007                        break; 
     1008                } 
    10071009            } 
     1010            else { 
     1011                switch((int) $content_struct["mt_allow_comments"]) { 
     1012                    case 0: 
     1013                        $comment_status = "closed"; 
     1014                        break; 
     1015                    case 1: 
     1016                        $comment_status = "open"; 
     1017                        break; 
     1018                    default: 
     1019                        $comment_status = get_option("default_comment_status"); 
     1020                        break; 
     1021                } 
     1022            } 
     1023        } 
     1024        else { 
     1025            $comment_status = get_option("default_comment_status"); 
    10081026        } 
    10091027 
    10101028        if(isset($content_struct["mt_allow_pings"])) { 
    1011             switch((int) $content_struct["mt_allow_pings"]) { 
    1012                 case 0: 
    1013                     $ping_status = "closed"; 
    1014                     break; 
    1015                 case 1: 
    1016                     $ping_status = "open"; 
    1017                     break; 
    1018                 default: 
    1019                     $ping_status = get_option("default_ping_status"); 
    1020                     break; 
     1029            if(!is_numeric($content_struct["mt_allow_pings"])) { 
     1030                switch($content["mt_allow_pings"]) { 
     1031                    case "closed": 
     1032                        $ping_status = "closed"; 
     1033                        break;   
     1034                    case "open": 
     1035                        $ping_status = "open"; 
     1036                        break; 
     1037                    default: 
     1038                        $ping_status = get_option("default_ping_status"); 
     1039                        break; 
     1040                } 
    10211041            } 
     1042            else { 
     1043                switch((int) $content_struct["mt_allow_pings"]) { 
     1044                    case 0: 
     1045                        $ping_status = "closed"; 
     1046                        break; 
     1047                    case 1: 
     1048                        $ping_status = "open"; 
     1049                        break; 
     1050                    default: 
     1051                        $ping_status = get_option("default_ping_status"); 
     1052                        break; 
     1053                } 
     1054            } 
     1055        } 
     1056        else { 
     1057            $ping_status = get_option("default_ping_status"); 
    10221058        } 
    10231059 
     
    11711207        } 
    11721208 
     1209        if(isset($content_struct["mt_allow_comments"])) { 
     1210            if(!is_numeric($content_struct["mt_allow_comments"])) { 
     1211                switch($content_struct["mt_allow_comments"]) { 
     1212                    case "closed": 
     1213                        $comment_status = "closed"; 
     1214                        break; 
     1215                    case "open": 
     1216                        $comment_status = "open"; 
     1217                        break; 
     1218                    default: 
     1219                        $comment_status = get_option("default_comment_status"); 
     1220                        break; 
     1221                } 
     1222            } 
     1223            else { 
     1224                switch((int) $content_struct["mt_allow_comments"]) { 
     1225                    case 0: 
     1226                        $comment_status = "closed"; 
     1227                        break; 
     1228                    case 1: 
     1229                        $comment_status = "open"; 
     1230                        break; 
     1231                    default: 
     1232                        $comment_status = get_option("default_comment_status"); 
     1233                        break; 
     1234                } 
     1235            } 
     1236        } 
     1237 
     1238        if(isset($content_struct["mt_allow_pings"])) { 
     1239            if(!is_numeric($content_struct["mt_allow_pings"])) { 
     1240                switch($content["mt_allow_pings"]) { 
     1241                    case "closed": 
     1242                        $ping_status = "closed"; 
     1243                        break;   
     1244                    case "open": 
     1245                        $ping_status = "open"; 
     1246                        break; 
     1247                    default: 
     1248                        $ping_status = get_option("default_ping_status"); 
     1249                        break; 
     1250                } 
     1251            } 
     1252            else { 
     1253                switch((int) $content_struct["mt_allow_pings"]) { 
     1254                    case 0: 
     1255                        $ping_status = "closed"; 
     1256                        break; 
     1257                    case 1: 
     1258                        $ping_status = "open"; 
     1259                        break; 
     1260                    default: 
     1261                        $ping_status = get_option("default_ping_status"); 
     1262                        break; 
     1263                } 
     1264            } 
     1265        } 
     1266 
    11731267        // Only set ping_status if it was provided. 
    11741268        if(isset($content_struct["mt_allow_pings"])) { 
     
    12131307      if ( is_array($to_ping) ) 
    12141308        $to_ping = implode(' ', $to_ping); 
    1215  
    1216       if(isset($content_struct["mt_allow_comments"])) { 
    1217         $comment_status = (int) $content_struct["mt_allow_comments"]; 
    1218       } 
    12191309 
    12201310      // Do some timestamp voodoo