_userid; if (!loadPhpExtension('openssl')) { trigger_error( sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'Facebook'), E_USER_WARNING); return $this->_tryNextUser(); } $web = new HttpClient("www.facebook.com", 80); if (DEBUG & _DEBUG_LOGIN) $web->setDebug(true); // collect cookies from http://www.facebook.com/login.php $web->persist_cookies = true; $web->cookie_host = 'www.facebook.com'; $firstlogin = $web->get("/login.php"); if (!$firstlogin) { if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) trigger_error(sprintf(_("Facebook connect failed with %d %s"), $web->status, $web->errormsg), E_USER_WARNING); } // Switch from http to https://login.facebook.com/login.php $web->port = 443; $web->host = 'login.facebook.com'; if (!($retval = $web->post("/login.php", array('user' => $userid, 'pass' => $password)))) { if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) trigger_error(sprintf(_("Facebook login failed with %d %s"), $web->status, $web->errormsg), E_USER_WARNING); } $this->_authmethod = 'Facebook'; if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval", E_USER_WARNING); if ($retval) { $this->_level = WIKIAUTH_USER; } else { $this->_level = WIKIAUTH_ANON; } return $this->_level; } // TODO: msearch facebook for the username function userExists() { if (!loadPhpExtension('openssl')) { trigger_error( sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'Facebook'), E_USER_WARNING); return $this->_tryNextUser(); } if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); return true; } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: