Changes from trunk/wp-app.php at r8267 to branches/2.6/wp-app.php at r8399
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/wp-app.php
r8267 r8399 207 207 // authenticate regardless of the operation and set the current 208 208 // user. each handler will decide if auth is required or not. 209 $this->authenticate(); 210 $u = wp_get_current_user(); 211 if(!isset($u) || $u->ID == 0) { 209 if(!$this->authenticate()) { 212 210 if ($always_authenticate) { 213 211 $this->auth_required('Credentials required.'); … … 395 393 396 394 $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true; 395 $post_status = ($publish) ? 'publish' : 'draft'; 397 396 398 397 extract($entry); … … 407 406 $post_modified = $pubtimes[0]; 408 407 $post_modified_gmt = $pubtimes[1]; 409 410 // let's not go backwards and make something draft again.411 if(!$publish && $post_status == 'draft') {412 $post_status = ($publish) ? 'publish' : 'draft';413 } elseif($publish) {414 $post_status = 'publish';415 }416 408 417 409 $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); … … 1071 1063 */ 1072 1064 function authenticate() { 1073 $login_data = array();1074 $already_md5 = false;1075 1076 1065 log_app("authenticate()",print_r($_ENV, true)); 1077 1066 … … 1085 1074 // If Basic Auth is working... 1086 1075 if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { 1087 $login_data = array('login' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']); 1088 log_app("Basic Auth",$login_data['login']); 1089 } else { 1090 // else, do cookie-based authentication 1091 if (function_exists('wp_get_cookie_login')) { 1092 $login_data = wp_get_cookie_login(); 1093 $already_md5 = true; 1076 log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']); 1077 $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); 1078 if ( $user && !is_wp_error($user) ) { 1079 wp_set_current_user($user->ID); 1080 log_app("authenticate()", $_SERVER['PHP_AUTH_USER']); 1081 return true; 1094 1082 } 1095 1083 } 1096 1084 1097 // call wp_login and set current user 1098 if (!empty($login_data) && wp_login($login_data['login'], $login_data['password'], $already_md5)) { 1099 $current_user = new WP_User(0, $login_data['login']); 1100 wp_set_current_user($current_user->ID); 1101 log_app("authenticate()",$login_data['login']); 1102 } 1085 return false; 1103 1086 } 1104 1087
Note: See TracChangeset
for help on using the changeset viewer.