Skip to content

Commit

Permalink
#8 simplified getLoginUrl to support different types
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Aug 9, 2013
1 parent d75e527 commit 9670bb4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions helpers/fb.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,24 @@ function getAdmins(){

}

// simplified version of Facebook's getLoginUrl
function getLoginUrl( $type="website" ){
var $options = array();
// localhost always uses OAuth?
if( $type=="website" || IS_LOCALHOST){
// do nothing - defaults should be ok
} else if( $type=="tab" ){
// get page tab from request
$options['redirect_uri'] = "https://facebook.com/". $this->request["page"]["id"] ."?sk=app_". FB_APPID;
} else if ( $type=="canvas" ){
$options['redirect_uri'] = "https://apps.facebook.com/". $GLOBALS['config']['facebook']['uri'];
} else {
// also include $type == app ?
}
return FB_OAuth::link( $options, false);
}


private function parsePageSignedRequest() {
// prerequisite
if( !array_key_exists("fb", $_SESSION) ) $_SESSION["fb"] = array();
Expand Down

0 comments on commit 9670bb4

Please sign in to comment.