public function unblock($token, $logger)
 {
     // prune old tokens:
     $this->_db->setQuery('DELETE FROM #__bfstop_unblock_token ' . 'WHERE DATE_ADD(crdate, INTERVAL ' . self::TokenValidDays . ' DAY) < ' . $this->_db->quote(date('Y-m-d H:i:s')));
     $this->_db->execute();
     BFStopDBHelper::checkDBError($this->_db, $logger);
     // get token:
     $this->_db->setQuery('SELECT * FROM #__bfstop_unblock_token WHERE token=' . $this->_db->quote($token));
     $unblockTokenEntry = $this->_db->loadObject();
     BFStopDBHelper::checkDBError($this->_db, $logger);
     if ($unblockTokenEntry == null) {
         $logger->log("com_bfstop-tokenunblock: Token not found.", JLog::ERROR);
         return false;
     }
     BFStopUnblockHelper::unblock($this->_db, array($unblockTokenEntry->block_id), 1, $logger);
     $sql = 'DELETE FROM #__bfstop_unblock_token WHERE token=' . $this->_db->quote($token);
     $this->_db->setQuery($sql);
     $success = $this->_db->execute();
     BFStopDBHelper::checkDBError($this->_db, $logger);
     if (!$success) {
         $logger->log("com_bfstop-tokenunblock: Could not delete unblock_token.", JLog::ERROR);
     } else {
         $logger->log("com_bfstop-tokenunblock: Successfully unblocked with token.", JLog::INFO);
     }
     return $success;
 }
 public function unblock($ids, $logger)
 {
     if (min($ids) <= 0) {
         $idStr = implode(", ", $ids);
         $logger->log("Invalid IDs ({$idStr})!", JLog::ERROR);
         return JText::sprintf("UNBLOCK_INVALIDID", $idStr);
     }
     if (BFStopUnblockHelper::unblock(JFactory::getDBO(), $ids, 0, $logger)) {
         return JText::_("UNBLOCK_SUCCESS");
     } else {
         return JText::_("UNBLOCK_FAILED");
     }
 }