The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
includes/facebook_oauth.php - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: includes/facebook_oauth.php (/showthread.php?tid=647)



includes/facebook_oauth.php - firestorm - 07-17-2017

noticed in the above file our app id isn't being used in the javascript, so have adapted the script for for that.

<pre>
Code:
$db=DB::getInstance();

$settingsQ=$db->query("SELECT * FROM settings");
$settings=$settingsQ->first();

$appID=$settings->fbid;
$secret=$settings->fbsecret;
$version=$settings->graph_ver;
$callback=$settings->fbcallback;
?>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      //appId      : '256684718065631',
      appId      : <?=$appID?>,
      xfbml      : true,
      version    : 'v2.7'
    });
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

<?php
if(!isset($_SESSION)){session_start();}
require_once("src/Facebook/autoload.php");
$fb = new Facebook\Facebook([
  'app_id' => $appID,
  'app_secret' => $secret,
  'default_graph_version' => $version,
  ]);

$helper = $fb->getRedirectLoginHelper();

$permissions = ['email']; // Optional permissions
$loginUrl = $helper->getLoginUrl($callback, $permissions);

echo '<a href="' . htmlspecialchars($loginUrl) . '"><img width="240" class="img-responsive pull-left" src="'
.TR_URL_ROOT.'users/images/facebook.png" alt="Facebook"/></a>';
</pre>