<commit_before>package net.liftweb.ext_api.facebook;

import net.liftweb.http.{S, SessionVar}
import net.liftweb.util.Helpers._
import net.liftweb.util.{Can, Empty, Failure, Full}

object Facebook {
  object API extends SessionVar[Can[FacebookClient]](sessionKey.map(k => new FacebookClient(k)))
  
  def canvasPage_? : boolean = S.param("fb_sig_in_canvas") match {
    case Full(num) if toInt(num) == 1 => true
    case _ => false
  }
  
  def addedApplication_? : boolean = S.param("fb_sig_added") match {
    case Full(num) if toInt(num) == 1 => true
    case _ => false
  }
  
  def loggedIn_? : boolean = S.param("fb_sig_user") match {
    case Full(num) if toInt(num) > 0 => true
    case _ => false
  }
  
  def userId: Can[Int] = S.param("fb_sig_user") match {
    case Full(num) => Full(toInt(num))
    case _ => Empty
  }
  
  def userId_! : Int = userId.open_!
  
  def sessionKey : Can[String] = S.param("fb_sig_session_key")
  
  def sessionKey_! : String = sessionKey.open_!
  
  def loginUrl: String = "http://www.facebook.com/login.php?api_key=" + FacebookRestApi.apiKey + "&v=1.0"
}<commit_msg>Tweak to Facebook library<commit_after>package net.liftweb.ext_api.facebook;

import net.liftweb.http.{S, SessionVar}
import net.liftweb.util.Helpers._
import net.liftweb.util.{Can, Empty, Failure, Full}

object Facebook {
  object API extends SessionVar[Can[FacebookClient]](sessionKey.map(k => new FacebookClient(k)))
  
  def canvasPage_? : boolean = S.param("fb_sig_in_canvas") match {
    case Full(num) if toInt(num) == 1 => true
    case _ => false
  }
  
  def addedApplication_? : boolean = S.param("fb_sig_added") match {
    case Full(num) if toInt(num) == 1 => true
    case _ => false
  }
  
  def loggedIn_? : boolean = S.param("fb_sig_user") match {
    case Full(num) if toInt(num) > 0 => true
    case _ => false
  }
  
  def userId: Can[Int] = S.param("fb_sig_user") match {
    case Full(num) => Full(toInt(num))
    case _ => Empty
  }
  
  def userId_! : Int = userId.open_!
  
  def sessionKey : Can[String] = S.param("fb_sig_session_key")
  
  def sessionKey_! : String = sessionKey.open_!
  
  def loginUrl: String = "http://www.facebook.com/login.php?api_key=" + FacebookRestApi.apiKey + "&v=1.0"
  def addUrl : String = "http://www.facebook.com/add.php?api_key=" + FacebookRestApi.apiKey
}
{'fraction_non_alphanumeric': 0.14402407566638006, 'fraction_numerical': 0.004299226139294927, 'mean_word_length': 3.6262425447316105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4669185', 'n_tokens_mistral': 861, 'n_tokens_neox': 845, 'n_words': 182}