Permalink
Browse files

Checked in FBConnect r91 from 2008 under /tags for archival purposes

  • Loading branch information...
0 parents commit 1bfadd6a1850e0112df041105edf1008492873d4 @garbear committed Mar 28, 2010
@@ -0,0 +1,21 @@
+<?php
+/**
+ * FBConnect.alias.php - FBConnect for MediaWiki
+ *
+ * Special Page alias file... for when we actually define some special pages ;-)
+ */
+
+
+/*
+ * Not a valid entry point, skip unless MEDIAWIKI is defined.
+ */
+if ( !defined( 'MEDIAWIKI' ) ) {
+ die( 'This file is a MediaWiki extension, it is not a valid entry point' );
+}
+
+$aliases = array();
+
+/** English */
+$aliases['en'] = array(
+ 'Connect' => array( 'Connect', 'ConnectAccount' ),
+);
@@ -0,0 +1,77 @@
+<?php
+/**
+ * FBConnect.i18n.php - FBConnect for MediaWiki
+ *
+ * Internationalization file... for when Facebook Connect is internationalized ;-)
+ */
+
+
+/*
+ * Not a valid entry point, skip unless MEDIAWIKI is defined.
+ */
+if ( !defined( 'MEDIAWIKI' ) ) {
+ die( 'This file is a MediaWiki extension, it is not a valid entry point' );
+}
+
+$messages = array();
+
+if (!defined( 'fb' )) {
+ define( 'fb', 'fbconnect-' );
+}
+
+
+/** English */
+$messages['en'] = array(
+// Extension name
+'fbconnect' => 'Facebook Connect',
+fb.'desc' => 'Enables users to [[Special:Connect|Connect]] with their [http://www.facebook.com Facebook] ' .
+ 'accounts. Offers authentification based on Facebook groups (soon!) and the use of FBML in wiki text.',
+// Group containing Facebook Connect users
+'group-fb-user' => 'Facebook Connect users',
+'group-fb-user-member' => 'Facebook Connect user',
+'grouppage-fb-user' => '{{ns:project}}:Facebook Connect users',
+// Group for Facebook Connect users beloning to the group specified by $fbUserRightsFromGroup
+'group-fb-groupie' => 'Group members',
+'group-fb-groupie-member' => 'Group member',
+'grouppage-fb-groupie' => '{{ns:project}}:Group members',
+// Officers of the Facebook group
+'group-fb-officer' => 'Group officers',
+'group-fb-officer-member' => 'Group officer',
+'grouppage-fb-officer' => '{{ns:project}}:Group officers',
+// Admins of the Facebook group
+'group-fb-admin' => 'Group admins',
+'group-fb-admin-member' => 'Group administrator',
+'grouppage-fb-admin' => '{{ns:project}}:Group admins',
+// Incredibly good looking people
+'right-goodlooking' => 'Really, really, ridiculously good looking',
+// Personal toolbar
+fb.'connect' => 'Connect this account with Facebook',
+fb.'logout' => 'Logout of Facebook',
+fb.'link' => 'Back to facebook.com',
+// Special:Connect
+fb.'title' => 'Connect account with Facebook',
+fb.'intro' => 'This wiki is enabled with Facebook Connect, the next evolution of Facebook Platform. This means ' .
+ 'that when you are Connected, in addition to the normal [[Wikipedia:Help:Logging in#Why log in?' .
+ '|benefits]] you see when logging in, you will be able to take advantage of some extra features...',
+fb.'conv' => 'Convenience',
+fb.'convdesc' => 'Connected users are automatically logged you in. If permission is given, then this wiki can even ' .
+ 'use Facebook as an email proxy so you can continue to receive important notifications without ' .
+ 'revealing your email address.',
+fb.'fbml' => 'Facebook Markup Language',
+fb.'fbmldesc' => 'Facebook has provided a bunch of built-in tags that will render dynamic data. Many of these tags ' .
+ 'can be included in wiki text, and will be rendered differently depending on which Connected user ' .
+ 'they are being viewed by.',
+fb.'comm' => 'Communication',
+fb.'commdesc' => 'Facebook Connect ushers in a whole new level of networking. See which of your friends are using ' .
+ 'the wiki, and optionally share your actions with your friends through the Facebook News Feed.',
+fb.'welcome' => 'Welcome, Facebook Connect user!',
+fb.'loginbox' => "Or '''login''' with Facebook:\n\n$1",
+fb.'merge' => 'Merge your wiki account with your Facebook ID',
+fb.'mergebox' => 'This feature has not yet been implemented. Accounts can be merged manually with [[Special:' .
+ 'Renameuser]] if it is installed. For more information, please visit [[MediaWikiWiki:Extension:' .
+ "Renameuser|Extension:Renameuser]].\n\n\n$1\n\n\nNote: This can be undone by a sysop.",
+fb.'logoutbox'=> "$1\n\nThis will also log you out of Facebook and all Connected sites, including this wiki.",
+fb.'listusers-header'
+ => '$1 and $2 privileges are automatically transfered from the Officer and Admin titles of the ' .
+ "Facebook group $3.\n\nFor more info, please contact the group creator $4.",
+);
@@ -0,0 +1,180 @@
+<?php
+/**
+ * Copyright © 2008 Garrett Brown <http://www.mediawiki.org/wiki/User:Gbruin>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @author Garrett Bruin
+ * @copyright Copyright © 2008 Garrett Brown
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ * @addtogroup Extensions
+ *
+ *
+ * FBConnect plugin. Integrates Facebook Connect into MediaWiki.
+ *
+ * Facebook Connect single sign on (SSO) experience and XFBML are currently available.
+ * Please rename config.sample.php to config.php, follow the instructions inside and
+ * customize variables as you like to set up your Facebook Connect extension.
+ *
+ * Info is available at http://www.mediawiki.org/wiki/Extension:FBConnect
+ * and at http://wiki.developers.facebook.com/index.php/MediaWiki
+ *
+ * Limited support is available at http://www.mediawiki.org/wiki/Extension_talk:FBConnect
+ * and at http://wiki.developers.facebook.com/index.php/Talk:MediaWiki
+ *
+ */
+
+
+/**
+ * Not a valid entry point, skip unless MEDIAWIKI is defined.
+ */
+if ( !defined( 'MEDIAWIKI' )) {
+ die( 'This file is a MediaWiki extension, it is not a valid entry point' );
+}
+
+/**
+ * FBConnect version. Note: this is not necessarily the most recent SVN revision number.
+ */
+define( 'MEDIAWIKI_FBCONNECT_VERSION', 'r71, January 25, 2009' );
+
+/**
+ * Add information about this extension to Special:Version.
+ */
+$wgExtensionCredits['specialpage'][] = array(
+ 'name' => 'Facebook Connect Plugin',
+ 'author' => 'Garrett Brown',
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:FBConnect',
+ 'descriptionmsg' => 'fbconnect-desc',
+ 'version' => MEDIAWIKI_FBCONNECT_VERSION,
+);
+
+/**
+ * Initialization of the autoloaders and special extension pages.
+ */
+$dir = dirname(__FILE__) . '/';
+require_once $dir . 'config.php';
+require_once $dir . 'facebook-client/facebook.php';
+
+$wgExtensionMessagesFiles['FBConnect'] = $dir . 'FBConnect.i18n.php';
+$wgExtensionAliasesFiles['FBConnect'] = $dir . 'FBConnect.alias.php';
+
+$wgAutoloadClasses['FBConnectAPI'] = $dir . 'FBConnectAPI.php';
+$wgAutoloadClasses['FBConnectAuthPlugin'] = $dir . 'FBConnectAuthPlugin.php';
+$wgAutoloadClasses['FBConnectHooks'] = $dir . 'FBConnectHooks.php';
+$wgAutoloadClasses['FBConnectXFBML'] = $dir . 'FBConnectXFBML.php';
+$wgAutoloadClasses['SpecialConnect'] = $dir . 'SpecialConnect.php';
+
+$wgSpecialPages['Connect'] = 'SpecialConnect';
+#$wgSpecialPages['NewsFeed'] = 'SpecialNewsFeed';
+
+$wgExtensionFunctions[] = 'FBConnect::init';
+
+// If we are configured to pull group info from Facebook, then create the group permissions
+$wgGroupPermissions['fb-user'] = $wgGroupPermissions['user'];
+if( $fbUserRightsFromGroup ) {
+ $wgGroupPermissions['fb-groupie'] = $wgGroupPermissions['user'];
+ $wgGroupPermissions['fb-officer'] = $wgGroupPermissions['bureaucrat'];
+ $wgGroupPermissions['fb-admin'] = $wgGroupPermissions['sysop'];
+ $wgGroupPermissions['fb-officer']['goodlooking'] = true;
+ $wgImplictGroups[] = 'fb-groupie';
+ $wgImplictGroups[] = 'fb-officer';
+ $wgImplictGroups[] = 'fb-admin';
+}
+
+/**/
+// Define new autopromote condition (use quoted text, numbers can cause collisions)
+define( 'APCOND_FB_INGROUP', 'fb*g' );
+define( 'APCOND_FB_ISOFFICER', 'fb*o' );
+define( 'APCOND_FB_ISADMIN', 'fb*a' );
+
+$wgAutopromote['fb-groupie'] = APCOND_FB_INGROUP;
+$wgAutopromote['fb-officer'] = APCOND_FB_ISOFFICER;
+$wgAutopromote['fb-admin'] = APCOND_FB_ISADMIN;
+
+/**
+$wgAutopromote['autoconfirmed'] = array( '&', array( APCOND_EDITCOUNT, &$wgAutoConfirmCount ),
+ array( APCOND_AGE, &$wgAutoConfirmAge ),
+ array( APCOND_FB_INGROUP ));
+/**/
+
+$wgImplicitGroups[] = 'fb-groupie';
+$wgImplicitGroups[] = 'fb-officer';
+$wgImplicitGroups[] = 'fb-admin';
+
+
+/**
+ * Class FBConnect
+ *
+ * This class initializes the extension, and contains the core non-hook,
+ * non-authentification code.
+ */
+class FBConnect {
+ // Instance of our Facebook API class
+ public static $api;
+ // Whether we are rendering the Special:Connect page
+ public static $special_connect;
+
+ /**
+ * Initializes and configures the extension.
+ */
+ public static function init() {
+ global $wgXhtmlNamespaces, $wgAuth, $wgHooks;
+
+ self::$special_connect = false;
+ self::$api = new FBConnectAPI();
+
+ // The xmlns:fb attribute is required for proper rendering on IE
+ $wgXhtmlNamespaces['fb'] = 'http://www.facebook.com/2008/fbml';
+
+ // Set the global variable $wgAuth to our custom authentification plugin.
+ // The AuthPluginSetup hook is called right before init(), so we can't use this hook
+ $wgAuth = new StubObject( 'wgAuth', 'FBConnectAuthPlugin' );
+
+ // Install all public static functions in class FBConnectHooks as MediaWiki hooks
+ $hooks = self::enumMethods('FBConnectHooks');
+ foreach( $hooks as $hookName ) {
+ $wgHooks[$hookName][] = "FBConnectHooks::$hookName";
+ }
+
+ // 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', $wgParser );
+ }
+ }
+
+ /**
+ * Returns an array with the names of all public static functions
+ * in the specified class.
+ */
+ public static function enumMethods( $className ) {
+ $hooks = array();
+ try {
+ $class = new ReflectionClass( $className );
+ foreach( $class->getMethods( ReflectionMethod::IS_PUBLIC ) as $method ) {
+ if ( $method->isStatic() ) {
+ $hooks[] = $method->getName();
+ }
+ }
+ } catch( Exception $e ) {
+ // If PHP's version doesn't support the Reflection API, then exit
+ die( 'PHP version (' . phpversion() . ') must be great enough to support the Reflection API' );
+ // or...
+ $hooks = array('AuthPluginSetup', 'UserLoadFromSession',
+ 'RenderPreferencesForm', 'PersonalUrls',
+ 'ParserAfterTidy', 'BeforePageDisplay');
+ }
+ return $hooks;
+ }
+}
Oops, something went wrong.

0 comments on commit 1bfadd6

Please sign in to comment.