Ejemplo n.º 1
0
 /**
  * Disconnect from facebook
  */
 private function disconnectReclamationAction()
 {
     global $wgRequest, $wgOut, $wgUser;
     $wgOut->setArticleRelated(false);
     $wgOut->enableClientCache(false);
     $wgOut->mRedirect = '';
     $wgOut->mBodytext = '';
     $wgOut->setRobotPolicy('noindex,nofollow');
     $fb = new FBConnectAPI();
     $user = $fb->verifyAccountReclamation($sRequest);
     if (!($user === false)) {
         $result = FBConnect::coreDisconnectFromFB($user);
     }
     $title = Title::makeTitle(NS_SPECIAL, "Signup");
     $html = Xml::openElement("a", array("href" => $title->getFullUrl()));
     $html .= $title->getPrefixedText();
     $html .= Xml::closeElement("a");
     if (!($user === false) && $result['status'] == "ok") {
         $wgOut->setPageTitle(wfMsg('fbconnect-reclamation-title'));
         $wgOut->setHTMLTitle(wfMsg('fbconnect-reclamation-title'));
         $wgOut->addHTML(wfMsg('fbconnect-reclamation-body', array("\$1" => $html)));
     } else {
         $wgOut->setPageTitle(wfMsg('fbconnect-reclamation-title-error'));
         $wgOut->setHTMLTitle(wfMsg('fbconnect-reclamation-title-error'));
         $wgOut->addHTML(wfMsg('fbconnect-reclamation-body-error', array("\$1" => $html)));
     }
     return true;
 }
Ejemplo n.º 2
0
 <a href="#"><?php 
        echo wfMsg('cnw-call-to-login');
        ?>
</a>
				<br>
				<?php 
        print '<fb:login-button id="fbAjaxSignupConnect" size="large" length="short"' . FBConnect::getPermissionsAttribute() . FBConnect::getOnLoginAttribute() . '>' . wfMsg('cnw-auth-facebook-signup') . '</fb:login-button>';
        ?>
			</p>
			<div class="facebook login">
				<span>- <?php 
        echo wfMsg('cnw-or');
        ?>
 -</span>
				<?php 
        print '<fb:login-button id="fbAjaxLoginConnect" size="large" length="short"' . FBConnect::getPermissionsAttribute() . FBConnect::getOnLoginAttribute() . '>' . wfMsg('cnw-auth-facebook-login') . '</fb:login-button>';
        ?>
			</div>
			<nav class="back-controls">
				<input type="button" value="<?php 
        echo wfMsg('cnw-back');
        ?>
" class="secondary back">
			</nav>
			<nav class="next-controls">
				<input type="button" value="<?php 
        echo wfMsg('cnw-login');
        ?>
" class="login">
				<input type="button" value="<?php 
        echo wfMsg('cnw-signup');
Ejemplo n.º 3
0
        $this->username = preg_replace('/.+?\\/.*?([\\w\\.\\-_]+)$/', '$1', $user_profile['username']);
        // Most Facebook users don't have a name, only profile number
        if (!$this->username || preg_match('/^\\d+$/', $this->username)) {
            // Create a name like a uri used in stories
            if (strlen($user_profile['name']) > 2) {
                $this->username = User::get_valid_username($user_profile['name']);
            } else {
                $this->username = '******' . $this->username;
            }
        }
        $db->transaction();
        if (!$this->user_exists()) {
            $this->url = $user_profile['link'];
            $this->names = $user_profile['name'];
            if ($user_profile['username']) {
                $this->avatar = "http://graph.facebook.com/" . $user_profile['username'] . "/picture";
            }
            $this->store_user();
        }
        $this->store_auth();
        $db->commit();
        $this->user_login();
    }
}
$auth = new FBConnect();
// syslog(LOG_INFO, "FBconnect: ".$_SERVER["REQUEST_URI"]);
if ($auth->user) {
    $auth->authorize();
} else {
    $auth->authRequest();
}
Ejemplo n.º 4
0
<?php

session_start();
require 'FBConnect.php';
$objFBConnect = new FBConnect();
$objFBConnect->call();
$objFBConnect->clearSession();
header("Location:index.php");
exit;
Ejemplo n.º 5
0
	<?php 
global $wgEnableFacebookConnectExt;
if (!empty($wgEnableFacebookConnectExt)) {
    ?>
<h1><?php 
    if ($isOasis) {
        // Don't mention Facebook in the h1 on Oasis (doesn't look right).
        print wfMsg("fbconnect-wikia-login-or-create");
    } else {
        print wfMsg("fbconnect-wikia-login-w-facebook");
    }
    ?>
</h1>
			<div id="AjaxLoginFBStart">
				<?php 
    print '<fb:login-button id="fbAjaxLoginConnect" size="large" length="short"' . FBConnect::getPermissionsAttribute() . FBConnect::getOnLoginAttribute() . '></fb:login-button>';
    ?>
			</div>
			<div class="or-div">
				<span><?php 
    print wfMsg('fbconnect-or');
    ?>
</span>
			</div>
			<?php 
}
?>

	<div class="<?php 
echo $isOasis ? 'modal-tabs' : 'wikia-tabs';
?>
Ejemplo n.º 6
0
 public static function afterAjaxLoginHTML(&$html)
 {
     $tmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
     if (!LoginForm::getLoginToken()) {
         LoginForm::setLoginToken();
     }
     $tmpl->set("loginToken", LoginForm::getLoginToken());
     $tmpl->set("fbButtton", FBConnect::getFBButton("sendToConnectOnLoginForSpecificForm();", "fbPrefsConnect"));
     $html = $tmpl->execute('ajaxLoginMerge');
     return true;
 }
Ejemplo n.º 7
0
 /**
  * Initializes and configures the extension.
  */
 public static function init()
 {
     global $wgXhtmlNamespaces, $wgAuth, $wgHooks, $wgSharedTables, $wgUser;
     // The xmlns:fb attribute is required for proper rendering on IE
     $wgXhtmlNamespaces['fb'] = 'http://www.facebook.com/2008/fbml';
     // Install all public static functions in class FBConnectHooks as MediaWiki hooks
     $hooks = self::enumMethods('FBConnectHooks');
     global $fbHooksToAddImmediately;
     foreach ($hooks as $hookName) {
         if (!in_array($hookName, $fbHooksToAddImmediately)) {
             $wgHooks[$hookName][] = "FBConnectHooks::{$hookName}";
         }
     }
     // Allow configurable over-riding of the onLogin handler.
     global $fbOnLoginJsOverride;
     if (!empty($fbOnLoginJsOverride)) {
         self::$fbOnLoginJs = $fbOnLoginJsOverride;
     } else {
         self::$fbOnLoginJs = "window.location.reload(true);";
     }
     // ParserFirstCallInit was introduced in modern (1.12+) MW versions so as to
     // avoid unstubbing $wgParser on setHook() too early, as per r35980
     if (!defined('MW_SUPPORTS_PARSERFIRSTCALLINIT')) {
         global $wgParser;
         wfRunHooks('ParserFirstCallInit', array($wgParser));
     }
 }
Ejemplo n.º 8
0
      body {
        font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
      }
      h1 a {
        text-decoration: none;
        color: #3b5998;
      }
      h1 a:hover {
        text-decoration: underline;
      }
    </style>
  </head>
  <body>
    <h1>php-sdk</h1>
<?php 
$objFBConnect = new FBConnect();
$objFBConnect->call();
?>
    <?php 
if ($objFBConnect->_fbUser) {
    ?>
      <a href="<?php 
    echo $objFBConnect->_fbLogoutUrl;
    ?>
">Logout</a>
	  <br/>

    <?php 
} else {
    ?>
      <div>