}
}
if (trim($_SERVER['HTTPS']) == "" || $_SERVER['HTTPS'] == "off") {
    $dispHTTP = "http://";
} else {
    $dispHTTP = "https://";
}
include_once "../plugins/facebook/facebook.php";
$fbObj = new Facebook($mysqli);
$blnCheckForFacebook = $fbObj->hasFacebook($memberInfo['member_id']);
if ($blnCheckForFacebook) {
    $fbInfo = $fbObj->get_info_filtered();
    $fbID = $fbInfo['fbconnect_id'];
    if (time() - $fbInfo['lastupdate'] > 1800) {
        $fbObj->accessToken = $fbInfo['access_token'];
        $fbInfo = $fbObj->getFBInfo();
        if ($fbInfo == "") {
            // User revoked access through Facebook, refresh page and re-ask for access
            $fbObj->delete();
            echo "\n\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\n\t\t\t\t\twindow.location = '" . $MAIN_ROOT . "members/console.php?cID=" . $_GET['cID'] . "';\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\n\t\t\t";
            exit;
        }
        $arrColumns = array("name", "lastupdate");
        $arrValues = array($fbInfo['name'], time());
        $fbObj->select($fbID);
        $fbObj->update($arrColumns, $arrValues);
        $fbInfo = $fbObj->get_info_filtered();
    }
    echo "\n\t\n\t\t<div id='loadingSpiral' class='loadingSpiral'>\n\t\t\t<p align='center'>\n\t\t\t\t<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/loading-spiral.gif'><br>Loading\n\t\t\t</p>\n\t\t</div>\n\t\t<div id='connectedDiv'>\n\t\t\t<div class='formDiv'>\n\t\t\t\t<table class='formTable'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 20px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t<b>Connected:</b>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<div class='shadedBox' style='margin-left: auto; margin-right: auto; width: 50%; overflow: auto'>\n\t\n\t\t\t\t\t\t\t\t<div style='float: left; margin: 3px; padding: 0px' class='solidBox'><img src='" . $fbObj->getProfilePic("normal") . "'></div>\n\t\t\t\t\t\t\t\t<div style='float: left; padding-left: 8px; padding-top: 30px'>\n\t\t\t\t\t\t\t\t\t<span class='breadCrumbTitle' style='padding: 0px'><a href='https://www.facebook.com/profile.php?id=" . $fbInfo['facebook_id'] . "'>" . $fbInfo['name'] . "</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div style='font-style: italic; text-align: center; margin-top: 3px; margin-left: auto; margin-right: auto; position: relative' class='main'>\n\t\t\t\t\t\t\t\tLast updated " . getPreciseTime($fbInfo['lastupdate']) . "\n\t\t\t\t\t\t\t\t<p class='largeFont' style='font-style: normal; font-weight: bold' align='center'>\n\t\t\t\t\t\t\t\t\t<a style='cursor: pointer' id='btnDisconnect'>DISCONNECT ACCOUNT</a>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\t\t\n\t\t\t</div>\n\t\t</div>\n\t\t<div id='disconnectDiv' style='display: none'>\n\t\t\t<p class='main' align='center'>\n\t\t\t\tAre you sure you want to disconnect your Facebook account?\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\n\t\t\t\$(document).ready(function() {\n\t\t\t\n\t\t\t\t\$('#btnDisconnect').click(function() {\n\t\t\t\t\t\n\t\t\t\t\t\$('#disconnectDiv').dialog({\n\t\t\t\t\t\ttitle: 'Disconnect Facebook',\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeOut(250);\n\t\t\t\t\t\t\t\t\$('#loadingSpiral').show();\n\t\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "plugins/facebook/disconnect.php', { }, function(data) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').html(data);\n\t\t\t\t\t\t\t\t\t\$('#loadingSpiral').hide();\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeIn(250);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\$('.ui-dialog :button').blur();\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t});\n\t\t\n\t\t</script>\n\t\n\t";
} elseif (!$blnCheckForFacebook && isset($_GET['code'])) {
    $fbObj->tokenNonce = $_SESSION['btFacebookNonce'];
Exemple #2
0
<?php

/*
 * Bluethrust Clan Scripts v4
 * Copyright 2014
 *
 * Author: Bluethrust Web Development
 * E-mail: support@bluethrust.com
 * Website: http://www.bluethrust.com
 *
 * License: http://www.bluethrust.com/license.php
 *
 */
include_once "../../_setup.php";
include_once "../../classes/member.php";
$prevFolder = "../../";
include "facebook.php";
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$fbObj = new Facebook($mysqli);
if ($member->authorizeLogin($_SESSION['btPassword']) && $fbObj->hasFacebook($member->get_info("member_id"))) {
    $fbObj->accessToken = $fbObj->get_info_filtered("access_token");
    $fbObj->getFBInfo();
    $fbObj->delete();
    echo "\n\t\t\n\t\t<div class='shadedBox' style='width: 50%; margin-left: auto; margin-right: auto'>\n\t\t\n\t\t\t<p align='center' class='main' style='padding: 20px'>\n\t\t\t\tSuccessfully disconnected your Facebook account!<br><br>\n\t\t\t\t<a href='" . $MAIN_ROOT . "members'>Return to My Account</a>\n\t\t\t</p>\n\t\t\n\t\t</div>\n\t\n\t";
}