Changeset 1836
- Timestamp:
- 12/09/2008 10:40:10 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
bb-includes/functions.bb-posts.php (modified) (1 diff)
-
xmlrpc.php (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/functions.bb-posts.php
r1797 r1836 243 243 return false; 244 244 245 if ( !defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST ) 246 if ( !$user = bb_get_user( $poster_id ) ) 247 return false; 245 if ( !$user = bb_get_user( $poster_id ) ) 246 return false; 248 247 249 248 $topic_id = (int) $topic->topic_id; -
trunk/xmlrpc.php
r1806 r1836 94 94 **/ 95 95 var $auth_readonly = false; 96 97 /** 98 * Whether user switching is allowed 99 * 100 * @since 1.0 101 * @var boolean 102 **/ 103 var $allow_user_switching = false; 96 104 97 105 /** … … 160 168 $this->auth_readonly = apply_filters( 'bb_xmlrpc_auth_readonly', $this->auth_readonly ); 161 169 170 // Whether or not to allow user switching 171 $this->allow_user_switching = bb_get_option( 'bb_xmlrpc_allow_user_switching' ); 172 162 173 $this->initialise_site_option_info(); 163 174 $this->methods = apply_filters( 'bb_xmlrpc_methods', $this->methods ); … … 181 192 function authenticate( $user_login, $user_pass, $capability = 'read', $message = false ) 182 193 { 194 if ( is_array( $user_login ) ) { 195 $auth_user_login = (string) $user_login[0]; 196 $switch_user_login = (string) $user_login[1]; 197 } else { 198 $auth_user_login = (string) $user_login; 199 $switch_user_login = false; 200 } 201 183 202 // Check the login 184 $user = bb_check_login( $ user_login, $user_pass );203 $user = bb_check_login( $auth_user_login, $user_pass ); 185 204 if ( !$user || is_wp_error( $user ) ) { 186 205 $this->error = new IXR_Error( 403, __( 'Authentication failed.' ) ); 206 return false; 207 } 208 209 // Set the current user 210 $user = bb_set_current_user( $user->ID ); 211 212 // Make sure they are allowed to do this 213 if ( !bb_current_user_can( $capability ) ) { 214 if ( !$message ) { 215 $message = __( 'You do not have permission to read this.' ); 216 } 217 $this->error = new IXR_Error( 403, $message ); 218 return false; 219 } 220 221 // Switch the user if requested and allowed 222 if ( $switch_user_login && $this->allow_user_switching && bb_current_user_can( 'edit_users' ) ) { 223 $user = $this->switch_user( $switch_user_login, $capability, $message ); 224 } 225 226 return $user; 227 } 228 229 function switch_user( $user_login, $capability = 'read', $message = false ) 230 { 231 // Just get the user, authentication has already been established by the 232 $user = bb_get_user( $user_login ); 233 if ( !$user || is_wp_error( $user ) ) { 234 $this->error = new IXR_Error( 400, __( 'User switching failed, the requested user does not exist.' ) ); 187 235 return false; 188 236 } … … 380 428 381 429 // Get the login credentials 382 $username = (string)$args[0];430 $username = $args[0]; 383 431 $password = (string) $args[1]; 384 432 … … 419 467 420 468 // Get the login credentials 421 $username = (string)$args[0];469 $username = $args[0]; 422 470 $password = (string) $args[1]; 423 471 … … 498 546 499 547 // Get the login credentials 500 $username = (string)$args[0];548 $username = $args[0]; 501 549 $password = (string) $args[1]; 502 550 … … 542 590 543 591 if ( $depth > 0 ) { 544 // Add the depth to traverse to t o the arguments592 // Add the depth to traverse to the arguments 545 593 $get_forums_args['depth'] = $depth; 546 594 // Only make it hierarchical if the depth > 1 … … 619 667 620 668 // Get the login credentials 621 $username = (string)$args[0];669 $username = $args[0]; 622 670 $password = (string) $args[1]; 623 671 … … 729 777 730 778 // Get the login credentials 731 $username = (string)$args[0];779 $username = $args[0]; 732 780 $password = (string) $args[1]; 733 781 … … 810 858 811 859 // Get the login credentials 812 $username = (string)$args[0];860 $username = $args[0]; 813 861 $password = (string) $args[1]; 814 862 … … 910 958 911 959 // Get the login credentials 912 $username = (string)$args[0];960 $username = $args[0]; 913 961 $password = (string) $args[1]; 914 962 … … 1044 1092 1045 1093 // Get the login credentials 1046 $username = (string)$args[0];1094 $username = $args[0]; 1047 1095 $password = (string) $args[1]; 1048 1096 … … 1152 1200 1153 1201 // Get the login credentials 1154 $username = (string)$args[0];1202 $username = $args[0]; 1155 1203 $password = (string) $args[1]; 1156 1204 … … 1256 1304 1257 1305 // Get the login credentials 1258 $username = (string)$args[0];1306 $username = $args[0]; 1259 1307 $password = (string) $args[1]; 1260 1308 … … 1360 1408 1361 1409 // Get the login credentials 1362 $username = (string)$args[0];1410 $username = $args[0]; 1363 1411 $password = (string) $args[1]; 1364 1412 … … 1448 1496 1449 1497 // Get the login credentials 1450 $username = (string)$args[0];1498 $username = $args[0]; 1451 1499 $password = (string) $args[1]; 1452 1500 … … 1586 1634 1587 1635 // Get the login credentials 1588 $username = (string)$args[0];1636 $username = $args[0]; 1589 1637 $password = (string) $args[1]; 1590 1638 … … 1713 1761 1714 1762 // Get the login credentials 1715 $username = (string)$args[0];1763 $username = $args[0]; 1716 1764 $password = (string) $args[1]; 1717 1765 … … 1800 1848 1801 1849 // Get the login credentials 1802 $username = (string)$args[0];1850 $username = $args[0]; 1803 1851 $password = (string) $args[1]; 1804 1852 … … 1899 1947 1900 1948 // Get the login credentials 1901 $username = (string)$args[0];1949 $username = $args[0]; 1902 1950 $password = (string) $args[1]; 1903 1951 … … 1999 2047 2000 2048 // Get the login credentials 2001 $username = (string)$args[0];2049 $username = $args[0]; 2002 2050 $password = (string) $args[1]; 2003 2051 … … 2097 2145 2098 2146 // Get the login credentials 2099 $username = (string)$args[0];2147 $username = $args[0]; 2100 2148 $password = (string) $args[1]; 2101 2149 … … 2189 2237 2190 2238 // Get the login credentials 2191 $username = (string)$args[0];2239 $username = $args[0]; 2192 2240 $password = (string) $args[1]; 2193 2241 … … 2281 2329 2282 2330 // Get the login credentials 2283 $username = (string)$args[0];2331 $username = $args[0]; 2284 2332 $password = (string) $args[1]; 2285 2333 … … 2359 2407 2360 2408 // Get the login credentials 2361 $username = (string)$args[0];2409 $username = $args[0]; 2362 2410 $password = (string) $args[1]; 2363 2411 … … 2469 2517 2470 2518 // Get the login credentials 2471 $username = (string)$args[0];2519 $username = $args[0]; 2472 2520 $password = (string) $args[1]; 2473 2521 … … 2569 2617 2570 2618 // Get the login credentials 2571 $username = (string)$args[0];2619 $username = $args[0]; 2572 2620 $password = (string) $args[1]; 2573 2621 … … 2659 2707 2660 2708 // Get the login credentials 2661 $username = (string)$args[0];2709 $username = $args[0]; 2662 2710 $password = (string) $args[1]; 2663 2711 … … 2734 2782 2735 2783 // Get the login credentials 2736 $username = (string)$args[0];2784 $username = $args[0]; 2737 2785 $password = (string) $args[1]; 2738 2786 … … 2816 2864 2817 2865 // Get the login credentials 2818 $username = (string)$args[0];2866 $username = $args[0]; 2819 2867 $password = (string) $args[1]; 2820 2868 … … 2939 2987 2940 2988 // Get the login credentials 2941 $username = (string)$args[0];2989 $username = $args[0]; 2942 2990 $password = (string) $args[1]; 2943 2991 … … 3057 3105 3058 3106 // Get the login credentials 3059 $username = (string)$args[0];3107 $username = $args[0]; 3060 3108 $password = (string) $args[1]; 3061 3109 … … 3146 3194 3147 3195 // Get the login credentials 3148 $username = (string)$args[0];3196 $username = $args[0]; 3149 3197 $password = (string) $args[1]; 3150 3198 … … 3332 3380 3333 3381 // Get the login credentials 3334 $username = (string)$args[0];3382 $username = $args[0]; 3335 3383 $password = (string) $args[1]; 3336 3384 … … 3397 3445 3398 3446 // Get the login credentials 3399 $username = (string)$args[0];3447 $username = $args[0]; 3400 3448 $password = (string) $args[1]; 3401 3449
Note: See TracChangeset
for help on using the changeset viewer.