Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $script = '<script type=\'text/javascript\'>
- window.fbAsyncInit = function() {
- FB.init({ appId: \''.$consumerKey.'\',
- status: true,
- cookie: true,
- xfbml: true,
- oauth: true
- });
- button = jQuery(\'#fb-auth\');
- ajaxloader = jQuery(\'#cbajaxloader\');
- button.click(function(event) {
- event.preventDefault();
- FB.login(function(response) {
- if (response.authResponse) {
- FB.api(\'/me\', function(info) {
- login(response, info);
- });
- } else {
- //user cancelled login or did not grant authorization
- }
- }, {scope:\'offline_access,manage_pages,read_stream,user_about_me\'});
- });
- };
- (function() {
- var e = document.createElement(\'script\'); e.async = true;
- e.src = document.location.protocol
- + \'//connect.facebook.net/en_US/all.js\';
- document.getElementById(\'fb-root\').appendChild(e);
- }());
- function login(response, info){
- if (response.authResponse) {
- var accessToken = response.authResponse.accessToken;
- jQuery.ajax({
- type : \'POST\',
- url : \'index.php?option=com_cbsocialappsoauth&task=fbatstore&format=raw\',
- data : { \'accesstoken\' : accessToken,
- \'app\' : \'responsivefacebookpagestreammod\',
- \'consumerkey\' : \''.$consumerKey.'\',
- \'consumersecret\' : \''.$consumerSecret.'\',
- \'extid\' : '.$extid.',
- \''.JSession::getFormToken().'\' : 1
- },
- beforeSend : function(){
- ajaxloader.css({ display:"block" });
- },
- success : function(data){
- window.location=\''.JRoute::_($callback).'\';
- },
- error : function(){
- // failed request; give feedback to user
- }
- });
- }
- }
- function logout(response){
- }
- </script>';
Advertisement
Add Comment
Please, Sign In to add comment