summaryrefslogtreecommitdiffstats
path: root/wp-app.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
commitbfa3b629e0d67016ec83050c5db762479af40609 (patch)
tree4c9ae204172d0fad3ae056ccc65ffe9ea91134d2 /wp-app.php
parent7258ea2d7eeedb439607b72a1f74dee98e4b9d12 (diff)
downloadwordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.gz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.xz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.zip
Merge with WP revision 8635
git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1421 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-app.php')
-rw-r--r--wp-app.php35
1 files changed, 9 insertions, 26 deletions
diff --git a/wp-app.php b/wp-app.php
index 6451094..8244dab 100644
--- a/wp-app.php
+++ b/wp-app.php
@@ -206,9 +206,7 @@ class AtomServer {
// authenticate regardless of the operation and set the current
// user. each handler will decide if auth is required or not.
- $this->authenticate();
- $u = wp_get_current_user();
- if(!isset($u) || $u->ID == 0) {
+ if(!$this->authenticate()) {
if ($always_authenticate) {
$this->auth_required('Credentials required.');
}
@@ -394,6 +392,7 @@ EOD;
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
$publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
+ $post_status = ($publish) ? 'publish' : 'draft';
extract($entry);
@@ -407,13 +406,6 @@ EOD;
$post_modified = $pubtimes[0];
$post_modified_gmt = $pubtimes[1];
- // let's not go backwards and make something draft again.
- if(!$publish && $post_status == 'draft') {
- $post_status = ($publish) ? 'publish' : 'draft';
- } elseif($publish) {
- $post_status = 'publish';
- }
-
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt');
$this->escape($postdata);
@@ -1070,9 +1062,6 @@ EOD;
* Access credential through various methods and perform login
*/
function authenticate() {
- $login_data = array();
- $already_md5 = false;
-
log_app("authenticate()",print_r($_ENV, true));
// if using mod_rewrite/ENV hack
@@ -1084,22 +1073,16 @@ EOD;
// If Basic Auth is working...
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
- $login_data = array('login' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']);
- log_app("Basic Auth",$login_data['login']);
- } else {
- // else, do cookie-based authentication
- if (function_exists('wp_get_cookie_login')) {
- $login_data = wp_get_cookie_login();
- $already_md5 = true;
+ log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
+ $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+ if ( $user && !is_wp_error($user) ) {
+ wp_set_current_user($user->ID);
+ log_app("authenticate()", $_SERVER['PHP_AUTH_USER']);
+ return true;
}
}
- // call wp_login and set current user
- if (!empty($login_data) && wp_login($login_data['login'], $login_data['password'], $already_md5)) {
- $current_user = new WP_User(0, $login_data['login']);
- wp_set_current_user($current_user->ID);
- log_app("authenticate()",$login_data['login']);
- }
+ return false;
}
function get_accepted_content_type($types = NULL) {