/**
  * _authenticate()
  *
  * Authenticates the username and password
  *
  * This will return
  * - false	(Failed)
  * - true	(Succes)
  *
  * @access	private
  * @param  string  $username       	   			Username
  * @param  string  $password					Password
  * @return boolean
  **/
 private function _authenticate($username, $password)
 {
     //-----------------------------------------
     // Are they banned?
     //-----------------------------------------
     if (is_array($this->caches['banfilters']) and count($this->caches['banfilters'])) {
         foreach ($this->caches['banfilters'] as $ip) {
             $ip = str_replace('\\*', '.*', preg_quote($ip, "/"));
             if (preg_match("/^{$ip}\$/", $this->request['IP_ADDRESS'])) {
                 $this->error = $this->registry->class_localization->words['blogger_banned_msg'];
                 return false;
             }
         }
     }
     //-----------------------------------------
     // load the member
     //-----------------------------------------
     $member = IPSMember::load(IPSText::parseCleanValue($username), 'extendedProfile', 'username');
     if (!$member['member_id']) {
         $this->error = $this->registry->class_localization->words['blogger_unknown_user'];
         return false;
     }
     ips_MemberRegistry::setMember($member['member_id']);
     //--------------------------------
     //  Is the board offline?
     //--------------------------------
     if (ipsRegistry::$settings['board_offline'] == 1) {
         if ($member['g_access_offline'] != 1) {
             $this->error = $this->registry->class_localization->words['blogger_board_offline'];
             return false;
         }
     }
     //-----------------------------------------
     // Temporarely banned?
     //-----------------------------------------
     if ($member['temp_ban']) {
         $this->error = $this->registry->class_localization->words['blogger_suspended'];
         return false;
     }
     //-----------------------------------------
     // Load the Blog
     //-----------------------------------------
     $this->registry->blog_std->buildPerms();
     //-----------------------------------------
     // Users can have more than one blog - just
     // grab first one mysql returns
     //-----------------------------------------
     $blog = $this->registry->DB()->buildAndFetch(array('select' => 'blog_id, blog_name', 'from' => 'blog_blogs', 'where' => "member_id={$member['member_id']}"));
     if (!$blog['blog_id']) {
         $this->error = $this->registry->class_localization->words['blogger_noblog'];
         return false;
     }
     if (!($this->blog = $this->registry->blog_std->loadBlog($blog['blog_id'], 1))) {
         $this->error = $this->blog_std->error;
         return false;
     }
     //-----------------------------------------
     // Blog post permissions?
     //-----------------------------------------
     if (!$this->blog['allow_entry']) {
         $this->error = $this->registry->class_localization->words['blogger_nopost'];
         return false;
     }
     //-----------------------------------------
     // Validate password?
     //-----------------------------------------
     if (!ipsRegistry::$settings['blog_allow_xmlrpc'] or !$this->blog['blog_settings']['enable_xmlrpc']) {
         $this->error = $this->registry->class_localization->words['blogger_noxmlrpc'];
         return false;
     }
     if ($this->blog['blog_settings']['xmlrpc_password'] != md5(IPSText::parseCleanValue($password))) {
         if (isset($this->blog['blog_settings']['xmlrpc_failedattempts']) && $this->blog['blog_settings']['xmlrpc_failedattempts'] > 5) {
             $this->blog['blog_settings']['enable_xmlrpc'] = 0;
             $this->blog['blog_settings']['xmlrpc_failedattempts'] = 0;
             $blog_settings = serialize($this->blog['blog_settings']);
             $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}");
         } else {
             $this->blog['blog_settings']['xmlrpc_failedattempts'] = isset($this->blog['blog_settings']['xmlrpc_failedattempts']) ? intval($this->blog['blog_settings']['xmlrpc_failedattempts']) + 1 : 1;
             $blog_settings = serialize($this->blog['blog_settings']);
             $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}");
         }
         $this->error = $this->registry->class_localization->words['blogger_inv_pass'];
         return false;
     } else {
         if (isset($this->blog['blog_settings']['xmlrpc_failedattempts']) && $this->blog['blog_settings']['xmlrpc_failedattempts'] > 0) {
             $this->blog['blog_settings']['xmlrpc_failedattempts'] = 0;
             $blog_settings = serialize($this->blog['blog_settings']);
             $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}");
         }
     }
     //-----------------------------------------
     // Set the member data
     //-----------------------------------------
     $this->memberData = $member;
     return true;
 }