r67131 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67130‎ | r67131 | r67132 >
Date:08:09, 31 May 2010
Author:tisane
Status:reverted
Tags:
Comment:
=Changing config settings in FBConnect to globals to be set in LocalSettings.php rather than config.php
Modified paths:
  • /trunk/extensions/FBConnect/FBConnect.i18n.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnect.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnectAPI.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnectHooks.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnectPushEvent.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnectXFBML.php (modified) (history)
  • /trunk/extensions/FBConnect/SpecialConnect.php (modified) (history)
  • /trunk/extensions/FBConnect/config.sample.php (deleted) (history)
  • /trunk/extensions/FBConnect/fbconnect.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FBConnect/config.sample.php
@@ -1,198 +0,0 @@
2 -<?php
3 -/*
4 - * To install:
5 - * 1. Copy this file to config.php (remove the .sample part).
6 - * 2. Follow the instructions below to make the extension work.
7 - */
8 -
9 -
10 -### FBCONNECT CONFIGURATION VARIABLES ###
11 -
12 -/**
13 - * To use Facebook Connect you will first need to create a Facebook application:
14 - * 1. Visit the "Create an Application" setup wizard:
15 - * http://developers.facebook.com/setup/
16 - * 2. Enter a descriptive name for your wiki in the Site Name field.
17 - * This will be seen by users when they sign up for your site.
18 - * 3. Enter the Site URL and Locale, then click "Create application".
19 - * 4. Copy the displayed App ID and Secret into this config file.
20 - *
21 - * Optionally, you may customize your application:
22 - * A. Click "developer dashboard" link on the previous screen or visit:
23 - * http://www.facebook.com/developers/apps.php
24 - * B. Select your application and click "Edit Settings".
25 - * C. Upload icon and logo images. The icon appears in Stream stories.
26 - * D. In the "Connect" section, set your Connect Logo and base domain
27 - * (which should also be copied into this config file).
28 - */
29 -$fbAppId = 'YOUR_APP_ID'; # Change this!
30 -$fbSecret = 'YOUR_SECRET'; # Change this!
31 -#$fbDomain = 'BASE_DOMAIN'; # Optional
32 -
33 -/**
34 - * Disables the creation of new accounts and prevents old accounts from being
35 - * used to log in if they aren't associated with a Facebook Connect account.
36 - */
37 -$fbConnectOnly = false;
38 -
39 -/**
40 - * Allow the use of XFBML in wiki text.
41 - * For more info, see http://wiki.developers.facebook.com/index.php/XFBML.
42 - */
43 -$fbUseMarkup = true;
44 -
45 -/**
46 - * If XFBML is enabled, then <fb:photo> maybe be used as a replacement for
47 - * $wgAllowExternalImages with the added benefit that all photos are screened
48 - * against Facebook's Code of Conduct <http://www.facebook.com/codeofconduct.php>
49 - * and subject to dynamic privacy. To disable just <fb:photo> tags, set this to false.
50 - *
51 - * Disabled until the JavaScript SDK supports <fb:photo> tags.
52 - */
53 -#$fbAllowFacebookImages = true;
54 -
55 -/**
56 - * For easier wiki rights management, create a group on Facebook and place the
57 - * group ID here. Three new implicit groups will be created:
58 - *
59 - * fb-groupie A member of the specified group
60 - * fb-officer A group member with an officer title
61 - * fb-admin An administrator of the Facebook group
62 - *
63 - * By default, they map to User, Bureaucrat and Sysop privileges, respectively.
64 - * Users will automatically be promoted or demoted when their membership, title
65 - * or admin status is modified from the group page within Facebook.
66 - */
67 -$fbUserRightsFromGroup = false; # Or a group ID
68 -
69 -// Not used (yet...)
70 -#$fbRestrictToGroup = true;
71 -#$fbRestrictToNotReplied = false;
72 -
73 -/**
74 - * Options regarding the personal toolbar (in the upper right).
75 - *
76 - * == Key == == Effect ==
77 - * hide_connect_button Hides the "Log in with Facebook Connect" button.
78 - * hide_convert_button Hides "Connect this account with Facebook" for non-
79 - * Connected users.
80 - * hide_logout_of_fb Hides the "logout of facebook" button and leaves only
81 - * the button to log out of the current MediaWiki.
82 - * link_back_to_facebook Shows a handy "Back to facebook.com" link for Connected
83 - * users. This helps enforce the idea that this wiki is
84 - * "in front" of Facebook.
85 - * remove_user_talk_link Remove link to user's talk page
86 - * use_real_name_from_fb Show the real name for all Connected users
87 - *
88 - * Additionally, use $wgShowIPinHeader to hide the IP and its talk link.
89 - * For more information, see <http://www.mediawiki.org/wiki/Manual:$wgShowIPinHeader>.
90 - */
91 -$fbPersonalUrls = array(
92 - 'hide_connect_button' => false,
93 - 'hide_convert_button' => false,
94 - 'hide_logout_of_fb' => false,
95 - 'link_back_to_facebook' => true,
96 - 'remove_user_talk_link' => false,
97 - 'use_real_name_from_fb' => false,
98 -);
99 -#$wgShowIPinHeader = false;
100 -
101 -/**
102 - * The Facebook icon. You can copy this image to your server if you want, or
103 - * set to false to disable.
104 - */
105 -$fbLogo = 'http://static.ak.fbcdn.net/images/icons/favicon.gif';
106 -
107 -/**
108 - * URL of the Facebook Connect JavaScript SDK. Because this library is currently
109 - * a beta release, changes to the APIs may be made on a regular basis. If you
110 - * use FBConnect on your production website, you may wish to insulate yourself
111 - * from these changes by downloading and hosting your own copy of the library.
112 - *
113 - * For more info, see <http://developers.facebook.com/docs/reference/javascript/>
114 - */
115 -$fbScript = 'http://connect.facebook.net/en_US/all.js';
116 -#$fbScript = 'https://connect.facebook.net/en_US/all.js';
117 -
118 -/**
119 - * Path to the extension's client-side JavaScript
120 - */
121 -global $wgScriptPath;
122 -#$fbExtensionScript = "$wgScriptPath/extensions/FBConnect/fbconnect.js"; // for development
123 -$fbExtensionScript = "$wgScriptPath/extensions/FBConnect/fbconnect.min.js";
124 -
125 -/**
126 - * Whether to include jQuery. This option is for backwards compatibility and is
127 - * ignored in version 1.16. Otherwise, if you already have jQuery included on
128 - * your site, you can safely set this to false.
129 - */
130 -$fbIncludeJquery = true;
131 -
132 -/**
133 - * Optionally override the default javascript handling which occurs when a user logs in.
134 - *
135 - * This will generally not be needed unless you are doing heavy customization of this extension.
136 - *
137 - * NOTE: This will be put inside of double-quotes, so any single-quotes should be used inside
138 - * of any JS in this variable.
139 - */
140 -//$fbOnLoginJsOverride = "sendToConnectOnLogin();";
141 -
142 -/**
143 - * Optionally turn off the inclusion of the PreferencesExtension. Since this
144 - * is an extension that you may already have installed in your instance of
145 - * MediaWiki, there is the option to turn off FBConnect's inclusion of it (which
146 - * will require you to already have PreferencesExtension enabled elsewhere).
147 - *
148 - * When running on MediaWiki v1.16 and above, the extension won't be included anyway.
149 - */
150 -$fbIncludePreferencesExtension = true;
151 -
152 -/**
153 - * An array of extended permissions to request from the user while they are
154 - * signing up.
155 - *
156 - * NOTE: If fbEnablePushToFacebook is true, then publish_stream will automatically be
157 - * added to this array.
158 - *
159 - * For more details see: http://developers.facebook.com/docs/authentication/permissions
160 - */
161 -$fbExtendedPermissions = array(
162 - //'publish_stream',
163 - //'read_stream',
164 - //'email',
165 - //'read_mailbox',
166 - //'offline_access',
167 - //'create_event',
168 - //'rsvp_event',
169 - //'sms',
170 - //'xmpp_login',
171 -);
172 -
173 -/**
174 - * PUSH EVENTS
175 - *
176 - * This section allows controlling of whether push events are enabled, and which
177 - * of the push events to use.
178 - */
179 -$fbEnablePushToFacebook = false;
180 -if(!empty($fbEnablePushToFacebook)){
181 - $fbPushDir = dirname(__FILE__) . '/pushEvents/';
182 -
183 - // Convenience loop for push event classes in the fbPushDir directory
184 - // whose file-name corresponds to the class-name. To add a push event
185 - // which does not meet these criteria, just explicitly add it below.
186 - $pushEventClassNames = array(
187 - 'FBPush_OnAddImage',
188 - 'FBPush_OnLargeEdit',
189 - 'FBPush_OnWatchArticle',
190 - );
191 - foreach($pushEventClassNames as $pClassName){
192 - $fbPushEventClasses[] = $pClassName;
193 - $wgAutoloadClasses[$pClassName] = $fbPushDir . "$pClassName.php";
194 - }
195 -
196 - // Example of explicitly adding a push event which doesn't meet the criteria above.
197 - // $fbPushEventClasses[] = 'FBPush_OnEXAMPLE_CLASS';
198 - // $wgAutoloadClasses['FBPush_OnEXAMPLE_CLASS'] = $fbPushDir . 'FBPush_OnEXAMPLE_version_1.php';
199 -}
Index: trunk/extensions/FBConnect/FBConnectXFBML.php
@@ -41,7 +41,7 @@
4242 * $tag argument with the $tag provided to createParserHook.
4343 */
4444 static function parserHook($innertext, $args, &$parser, $tag = '' ) {
45 - global $fbAllowFacebookImages;
 45+ global $wgFbAllowFacebookImages;
4646
4747 // Run hook to allow modifying the default behavior. If $override is
4848 // set, it is used instead. Return false to disable the tag.
@@ -63,17 +63,17 @@
6464 // Disable these tags by returning an empty string
6565 break;
6666 case 'fb:serverfbml':
67 - // TODO: Is this safe? Does it respect $fbAllowFacebookImages?
 67+ // TODO: Is this safe? Does it respect $wgFbAllowFacebookImages?
6868 $attrs = self::implodeAttrs( $args );
6969 // Don't recursively parse $innertext
7070 return "<fb:serverfbml{$attrs}>$innertext</fb:serverfbml>";
7171 case 'fb:profile-pic':
7272 #case 'fb:photo': // Dropped in new JavaScript SDK
7373 #case 'fb:video': // Dropped in new JavaScript SDK
74 - if (!$fbAllowFacebookImages) {
 74+ if (!$wgFbAllowFacebookImages) {
7575 break;
7676 }
77 - // Careful - no "break;" if $fbAllowFacebookImages is true
 77+ // Careful - no "break;" if $wgFbAllowFacebookImages is true
7878 default:
7979 // Allow other tags by default
8080 $attrs = self::implodeAttrs( $args );
@@ -111,12 +111,12 @@
112112 }
113113
114114 /**
115 - * Returns true if XFBML is enabled (i.e. $fbUseMarkup is not false).
116 - * Defaults to true if $fbUseMarkup is not set.
 115+ * Returns true if XFBML is enabled (i.e. $wgFbUseMarkup is not false).
 116+ * Defaults to true if $wgFbUseMarkup is not set.
117117 */
118118 static function isEnabled() {
119 - global $fbUseMarkup;
120 - return !isset($fbUseMarkup) || $fbUseMarkup;
 119+ global $wgFbUseMarkup;
 120+ return !isset($wgFbUseMarkup) || $wgFbUseMarkup;
121121 }
122122
123123 /**
Index: trunk/extensions/FBConnect/SpecialConnect.php
@@ -207,7 +207,7 @@
208208 }
209209
210210 protected function createUser($fb_id, $name) {
211 - global $wgUser, $wgOut, $fbConnectOnly, $wgAuth, $wgRequest, $wgMemc;
 211+ global $wgUser, $wgOut, $wgFbConnectOnly, $wgAuth, $wgRequest, $wgMemc;
212212 wfProfileIn(__METHOD__);
213213
214214 // Handle accidental reposts.
@@ -232,8 +232,8 @@
233233 if ( wfReadOnly() ) {
234234 $wgOut->readOnlyPage();
235235 return;
236 - } elseif ( !isset($fbConnectOnly) || !$fbConnectOnly ) {
237 - // These two permissions don't apply in $fbConnectOnly mode
 236+ } elseif ( !isset($wgFbConnectOnly) || !$wgFbConnectOnly ) {
 237+ // These two permissions don't apply in $wgFbConnectOnly mode
238238 if ( $wgUser->isBlockedFromCreateAccount() ) {
239239 wfDebug("FBConnect: Blocked user was attempting to create account via Facebook Connect.\n");
240240 $wgOut->showErrorPage('fbconnect-error', 'fbconnect-errortext');
@@ -353,8 +353,8 @@
354354 }
355355
356356 // Process the FBConnectPushEvent preference checkboxes if fbConnectPushEvents are enabled.
357 - global $fbEnablePushToFacebook;
358 - if($fbEnablePushToFacebook){
 357+ global $wgFbEnablePushToFacebook;
 358+ if($wgFbEnablePushToFacebook){
359359 global $fbPushEventClasses;
360360 if(!empty($fbPushEventClasses)){
361361 foreach($fbPushEventClasses as $pushEventClassName){
@@ -567,14 +567,14 @@
568568 */
569569 private function chooseNameForm($messagekey = 'fbconnect-chooseinstructions') {
570570 // Permissions restrictions.
571 - global $wgUser, $facebook, $wgOut, $fbConnectOnly;
 571+ global $wgUser, $facebook, $wgOut, $wgFbConnectOnly;
572572 $titleObj = SpecialPage::getTitleFor( 'Connect' );
573573 if ( wfReadOnly() ) {
574574 // The wiki is in read-only mode
575575 $wgOut->readOnlyPage();
576576 return;
577 - } elseif ( !isset($fbConnectOnly) || !$fbConnectOnly ) {
578 - // These two permissions don't apply in $fbConnectOnly mode
 577+ } elseif ( !isset($wgFbConnectOnly) || !$wgFbConnectOnly ) {
 578+ // These two permissions don't apply in $wgFbConnectOnly mode
579579 if ( $wgUser->isBlockedFromCreateAccount() ) {
580580 wfDebug("FBConnect: Blocked user was attempting to create account via Facebook Connect.\n");
581581 $wgOut->showErrorPage('fbconnect-error', 'fbconnect-errortext');
@@ -607,8 +607,8 @@
608608 <fieldset id="mw-fbconnect-choosename">
609609 <legend>' . wfMsg('fbconnect-chooselegend') . '</legend>
610610 <table>');
611 - // Let them attach to an existing user if $fbConnectOnly allows it
612 - if (!$fbConnectOnly) {
 611+ // Let them attach to an existing user if $wgFbConnectOnly allows it
 612+ if (!$wgFbConnectOnly) {
613613 // Grab the UserName from the cookie if it exists
614614 global $wgCookiePrefix;
615615 $name = isset($_COOKIE[$wgCookiePrefix . 'UserName']) ?
Index: trunk/extensions/FBConnect/FBConnectAPI.php
@@ -33,19 +33,19 @@
3434 class FBConnectAPI extends Facebook {
3535 // Constructor
3636 public function __construct() {
37 - global $fbAppId, $fbSecret, $fbDomain;
 37+ global $wgFbAppId, $wgFbSecret, $wgFbDomain;
3838 // Check to make sure config.sample.php was renamed properly
3939 if ( !$this->isConfigSetup() ) {
40 - exit( 'Please update $fbAppId and $fbSecret in config.php' );
 40+ exit( 'Please update $wgFbAppId and $wgFbSecret in config.php' );
4141 }
4242 $config = array(
43 - 'appId' => $fbAppId,
44 - 'secret' => $fbSecret,
 43+ 'appId' => $wgFbAppId,
 44+ 'secret' => $wgFbSecret,
4545 'cookie' => true,
4646 );
4747 // Include the optional domain parameter if it has been set
48 - if ( !empty($fbDomain) && $fbDomain != 'BASE_DOMAIN' ) {
49 - $config['domain'] = $fbDomain;
 48+ if ( !empty($wgFbDomain) && $wgFbDomain != 'BASE_DOMAIN' ) {
 49+ $config['domain'] = $wgFbDomain;
5050 }
5151 parent::__construct( $config );
5252 }
@@ -56,20 +56,20 @@
5757 * followed correctly.
5858 */
5959 public function isConfigSetup() {
60 - global $fbAppId, $fbSecret;
61 - $isSetup = isset($fbAppId) && $fbAppId != 'YOUR_APP_KEY' &&
62 - isset($fbSecret) && $fbSecret != 'YOUR_SECRET';
 60+ global $wgFbAppId, $wgFbSecret;
 61+ $isSetup = isset($wgFbAppId) && $wgFbAppId != 'YOUR_APP_KEY' &&
 62+ isset($wgFbSecret) && $wgFbSecret != 'YOUR_SECRET';
6363 if(!$isSetup) {
6464 // Check to see if they are still using the old variables
6565 global $fbApiKey, $fbApiSecret;
6666 if ( isset($fbApiKey) ) {
67 - $fbAppId = $fbApiKey;
 67+ $wgFbAppId = $fbApiKey;
6868 }
6969 if ( isset($fbApiSecret) ) {
70 - $fbSecret= $fbApiSecret;
 70+ $wgFbSecret= $fbApiSecret;
7171 }
72 - $isSetup = isset($fbAppId) && $fbAppId != 'YOUR_APP_KEY' &&
73 - isset($fbSecret) && $fbSecret != 'YOUR_SECRET';
 72+ $isSetup = isset($wgFbAppId) && $wgFbAppId != 'YOUR_APP_KEY' &&
 73+ isset($wgFbSecret) && $wgFbSecret != 'YOUR_SECRET';
7474 }
7575 return $isSetup;
7676 }
@@ -114,14 +114,14 @@
115115 * Retrieves group membership data from Facebook.
116116 */
117117 public function getGroupRights( $user = null ) {
118 - global $fbUserRightsFromGroup;
 118+ global $wgFbUserRightsFromGroup;
119119
120120 // Groupies can be members, officers or admins (the latter two infer the former)
121121 $rights = array('member' => false,
122122 'officer' => false,
123123 'admin' => false);
124124
125 - $gid = !empty($fbUserRightsFromGroup) ? $fbUserRightsFromGroup : false;
 125+ $gid = !empty($wgFbUserRightsFromGroup) ? $wgFbUserRightsFromGroup : false;
126126 if (// If no group ID is specified, then there's no group to belong to
127127 !$gid ||
128128 // If $user wasn't specified, set it to the logged in user
Index: trunk/extensions/FBConnect/FBConnect.php
@@ -19,8 +19,6 @@
2020 * FBConnect plugin. Integrates Facebook Connect into MediaWiki.
2121 *
2222 * Facebook Connect single sign on (SSO) experience and XFBML are currently available.
23 - * Please rename config.sample.php to config.php, follow the instructions inside and
24 - * customize variables as you like to set up your Facebook Connect extension.
2523 *
2624 * Info is available at http://www.mediawiki.org/wiki/Extension:FBConnect
2725 * and at http://wiki.developers.facebook.com/index.php/MediaWiki
@@ -62,15 +60,15 @@
6361 * Initialization of the autoloaders and special extension pages.
6462 */
6563 $dir = dirname(__FILE__) . '/';
66 -require_once $dir . 'config.php';
 64+require_once $dir . 'config.default.php';
6765 require_once $dir . 'php-sdk/facebook.php';
68 -if (!empty( $fbIncludePreferencesExtension ) && version_compare($wgVersion, '1.16', '<')) {
 66+if (!empty( $wgFbIncludePreferencesExtension ) && version_compare($wgVersion, '1.16', '<')) {
6967 require_once $dir . 'PreferencesExtension.php';
7068 }
7169
7270 $wgExtensionFunctions[] = 'FBConnect::init';
7371
74 -if( !empty( $fbEnablePushToFacebook ) ){
 72+if( !empty( $wgFbEnablePushToFacebook ) ){
7573 // Need to include it explicitly instead of autoload since it has initialization code of its own.
7674 // This should be done after FBConnect::init is added to wgExtensionFunctions so that FBConnect
7775 // gets fully initialized first.
@@ -98,7 +96,7 @@
9997 $wgGroupPermissions['fb-user'] = $wgGroupPermissions['user'];
10098
10199 // If we are configured to pull group info from Facebook, then create the group permissions
102 -if ($fbUserRightsFromGroup) {
 100+if ($wgFbUserRightsFromGroup) {
103101 $wgGroupPermissions['fb-groupie'] = $wgGroupPermissions['user'];
104102 $wgGroupPermissions['fb-officer'] = $wgGroupPermissions['bureaucrat'];
105103 $wgGroupPermissions['fb-admin'] = $wgGroupPermissions['sysop'];
@@ -131,7 +129,7 @@
132130 */
133131 public static function init() {
134132 global $wgXhtmlNamespaces, $wgSharedTables, $facebook, $wgHooks;
135 - global $fbOnLoginJsOverride;
 133+ global $wgFbOnLoginJsOverride;
136134
137135 // The xmlns:fb attribute is required for proper rendering on IE
138136 $wgXhtmlNamespaces['fb'] = 'http://www.facebook.com/2008/fbml';
@@ -149,8 +147,8 @@
150148 }
151149
152150 // Allow configurable over-riding of the onLogin handler.
153 - if(!empty($fbOnLoginJsOverride)){
154 - self::$fbOnLoginJs = $fbOnLoginJsOverride;
 151+ if(!empty($wgFbOnLoginJsOverride)){
 152+ self::$fbOnLoginJs = $wgFbOnLoginJsOverride;
155153 } else {
156154 self::$fbOnLoginJs = "window.location.reload(true);";
157155 }
@@ -191,10 +189,10 @@
192190 * Return the code for the permissions attribute (with leading space) to use on all fb:login-buttons.
193191 */
194192 public static function getPermissionsAttribute(){
195 - global $fbExtendedPermissions;
 193+ global $wgFbExtendedPermissions;
196194 $attr = "";
197 - if(!empty($fbExtendedPermissions)){
198 - $attr = " perms=\"".implode(",", $fbExtendedPermissions)."\"";
 195+ if(!empty($wgFbExtendedPermissions)){
 196+ $attr = " perms=\"".implode(",", $wgFbExtendedPermissions)."\"";
199197 }
200198 return $attr;
201199 } // end getPermissionsAttribute()
@@ -212,4 +210,4 @@
213211 }
214212 return $attr;
215213 } // end getOnLoginAttribute()
216 -}
 214+}
\ No newline at end of file
Index: trunk/extensions/FBConnect/FBConnectPushEvent.php
@@ -36,12 +36,12 @@
3737 wfProfileIn(__METHOD__);
3838
3939 // The push feature of the extension requires the publish_stream extended permission.
40 - global $fbExtendedPermissions;
 40+ global $wgFbExtendedPermissions;
4141 $PERMISSION_TO_PUBLISH = 'publish_stream';
42 - if(empty($fbExtendedPermissions) || !is_array($fbExtendedPermissions)){
43 - $fbExtendedPermissions = array($PERMISSION_TO_PUBLISH);
44 - } else if(!in_array($PERMISSION_TO_PUBLISH, $fbExtendedPermissions)){
45 - $fbExtendedPermissions[] = $PERMISSION_TO_PUBLISH;
 42+ if(empty($wgFbExtendedPermissions) || !is_array($wgFbExtendedPermissions)){
 43+ $wgFbExtendedPermissions = array($PERMISSION_TO_PUBLISH);
 44+ } else if(!in_array($PERMISSION_TO_PUBLISH, $wgFbExtendedPermissions)){
 45+ $wgFbExtendedPermissions[] = $PERMISSION_TO_PUBLISH;
4646 }
4747
4848 // Make sure that all of the push events were configured correctly.
Index: trunk/extensions/FBConnect/FBConnectHooks.php
@@ -62,10 +62,10 @@
6363 * Checks the autopromote condition for a user.
6464 */
6565 static function AutopromoteCondition( $cond_type, $args, $user, &$result ) {
66 - global $fbUserRightsFromGroup;
 66+ global $wgFbUserRightsFromGroup;
6767
6868 // Probably a redundant check, but with PHP you can never be too sure...
69 - if (!$fbUserRightsFromGroup) {
 69+ if (!$wgFbUserRightsFromGroup) {
7070 // No group to pull rights from, so the user can't be a member
7171 $result = false;
7272 return true;
@@ -91,16 +91,16 @@
9292 * Injects some important CSS and Javascript into the <head> of the page.
9393 */
9494 public static function BeforePageDisplay( &$out, &$sk ) {
95 - global $wgVersion, $fbLogo, $fbScript, $fbExtensionScript, $fbIncludeJquery,
 95+ global $wgVersion, $wgFbLogo, $wgFbScript, $wgFbExtensionScript, $wgFbIncludeJquery,
9696 $wgScriptPath, $wgJsMimeType, $wgStyleVersion;
9797
9898 // Asynchronously load the Facebook Connect JavaScript SDK before the page's content
99 - if(!empty($fbScript)){
 99+ if(!empty($wgFbScript)){
100100 $out->prependHTML('
101101 <div id="fb-root"></div>
102102 <script>
103103 (function(){var e=document.createElement("script");e.type="' .
104 - $wgJsMimeType . '";e.src="' . $fbScript .
 104+ $wgJsMimeType . '";e.src="' . $wgFbScript .
105105 '";e.async=true;document.getElementById("fb-root").appendChild(e)})();
106106 </script>' . "\n"
107107 );
@@ -112,18 +112,18 @@
113113 }
114114
115115 // Add a Facebook logo to the class .mw-fblink
116 - $style = empty($fbLogo) ? '' : <<<STYLE
 116+ $style = empty($wgFbLogo) ? '' : <<<STYLE
117117 /* Add a pretty logo to Facebook links */
118118 .mw-fblink {
119 - background: url($fbLogo) top left no-repeat !important;
 119+ background: url($wgFbLogo) top left no-repeat !important;
120120 padding-left: 17px !important;
121121 }
122122 STYLE;
123123
124124 // Things get a little simpler in 1.16...
125125 if (version_compare($wgVersion, '1.16', '>=')) {
126 - // Add a pretty Facebook logo if $fbLogo is set
127 - if ( !empty( $fbLogo) ) {
 126+ // Add a pretty Facebook logo if $wgFbLogo is set
 127+ if ( !empty( $wgFbLogo) ) {
128128 $out->addInlineStyle($style);
129129 }
130130
@@ -133,23 +133,23 @@
134134 $out->addScriptFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
135135
136136 // Add the script file specified by $url
137 - if(!empty($fbExtensionScript)){
138 - $out->addScriptFile($fbExtensionScript);
 137+ if(!empty($wgFbExtensionScript)){
 138+ $out->addScriptFile($wgFbExtensionScript);
139139 }
140140 } else {
141 - // Add a pretty Facebook logo if $fbLogo is set
142 - if ( !empty( $fbLogo) ) {
 141+ // Add a pretty Facebook logo if $wgFbLogo is set
 142+ if ( !empty( $wgFbLogo) ) {
143143 $out->addScript('<style type="text/css">' . $style . '</style>');
144144 }
145145
146146 // Don't include jQuery if it's already in use on the site
147 - if (!empty($fbIncludeJquery)){
 147+ if (!empty($wgFbIncludeJquery)){
148148 $out->addScriptFile("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
149149 }
150150
151151 // Add the script file specified by $url
152 - if(!empty($fbExtensionScript)){
153 - $out->addScript("<script type=\"$wgJsMimeType\" src=\"$fbExtensionScript?$wgStyleVersion\"></script>\n");
 152+ if(!empty($wgFbExtensionScript)){
 153+ $out->addScript("<script type=\"$wgJsMimeType\" src=\"$wgFbExtensionScript?$wgStyleVersion\"></script>\n");
154154 }
155155 }
156156 return true;
@@ -176,10 +176,10 @@
177177 /**
178178 * Adds several Facebook Connect variables to the page:
179179 *
180 - * fbAppId The application ID (see $fbAppId in config.php)
 180+ * fbAppId The application ID (see $wgFbAppId in config.php)
181181 * fbSession Assist the JavaScript SDK with loading the session
182 - * fbUseMarkup Should XFBML tags be rendered (see $fbUseMarkup in config.php)
183 - * fbLogo Facebook logo (see $fbLogo in config.php)
 182+ * fbUseMarkup Should XFBML tags be rendered (see $wgFbUseMarkup in config.php)
 183+ * fbLogo Facebook logo (see $wgFbLogo in config.php)
184184 * fbLogoutURL The URL to be redirected to on a disconnect
185185 *
186186 * This hook was added in MediaWiki version 1.14. See:
@@ -188,11 +188,11 @@
189189 * to retain backward compatability.
190190 */
191191 public static function MakeGlobalVariablesScript( &$vars ) {
192 - global $fbAppId, $facebook, $fbUseMarkup, $fbLogo, $wgTitle, $wgRequest;
193 - $vars['fbAppId'] = $fbAppId;
 192+ global $wgFbAppId, $facebook, $wgFbUseMarkup, $wgFbLogo, $wgTitle, $wgRequest;
 193+ $vars['fbAppId'] = $wgFbAppId;
194194 $vars['fbSession'] = $facebook->getSession();
195 - $vars['fbUseMarkup'] = $fbUseMarkup;
196 - $vars['fbLogo'] = $fbLogo ? true : false;
 195+ $vars['fbUseMarkup'] = $wgFbUseMarkup;
 196+ $vars['fbLogo'] = $wgFbLogo ? true : false;
197197 $vars['fbLogoutURL'] = Skin::makeSpecialUrl('Userlogout',
198198 $wgTitle->isSpecial('Preferences') ? '' :
199199 "returnto={$wgTitle->getPrefixedURL()}");
@@ -245,13 +245,13 @@
246246 */
247247 public static function PersonalUrls( &$personal_urls, &$wgTitle ) {
248248 global $facebook, $wgUser, $wgLang, $wgShowIPinHeader;
249 - global $fbPersonalUrls, $fbConnectOnly;
 249+ global $wgFbPersonalUrls, $wgFbConnectOnly;
250250 wfLoadExtensionMessages('FBConnect');
251251
252252 /*
253253 * Personal URLs option: remove_user_talk_link
254254 */
255 - if ($fbPersonalUrls['remove_user_talk_link'] &&
 255+ if ($wgFbPersonalUrls['remove_user_talk_link'] &&
256256 array_key_exists('mytalk', $personal_urls)) {
257257 unset($personal_urls['mytalk']);
258258 }
@@ -261,7 +261,7 @@
262262 /*
263263 * Personal URLs option: use_real_name_from_fb
264264 */
265 - if ( !empty( $fbPersonalUrls['use_real_name_from_fb'] ) ) {
 265+ if ( !empty( $wgFbPersonalUrls['use_real_name_from_fb'] ) ) {
266266 // Start with the real name in the database
267267 $name = $wgUser->getRealName();
268268 // Ask Facebook for the real name
@@ -280,7 +280,7 @@
281281 }
282282 }
283283 // Replace logout link with a button to disconnect from Facebook Connect
284 - if( empty( $fbPersonalUrls['hide_logout_of_fb'] ) ){
 284+ if( empty( $wgFbPersonalUrls['hide_logout_of_fb'] ) ){
285285 unset( $personal_urls['logout'] );
286286 $personal_urls['fblogout'] = array(
287287 'text' => wfMsg( 'fbconnect-logout' ),
@@ -291,7 +291,7 @@
292292 /*
293293 * Personal URLs option: link_back_to_facebook
294294 */
295 - if ($fbPersonalUrls['link_back_to_facebook']) {
 295+ if ($wgFbPersonalUrls['link_back_to_facebook']) {
296296 try {
297297 $fbUser = $facebook->api('/me');
298298 $link = $fbUser['link'];
@@ -311,7 +311,7 @@
312312 /*
313313 * Personal URLs option: hide_convert_button
314314 */
315 - if (!$fbPersonalUrls['hide_convert_button']) {
 315+ if (!$wgFbPersonalUrls['hide_convert_button']) {
316316 $personal_urls['fbconvert'] = array(
317317 'text' => wfMsg( 'fbconnect-convert' ),
318318 'href' => SpecialConnect::getTitleFor('Connect', 'Convert')->getLocalURL(
@@ -325,7 +325,7 @@
326326 /*
327327 * Personal URLs option: hide_connect_button
328328 */
329 - if (!$fbPersonalUrls['hide_connect_button']) {
 329+ if (!$wgFbPersonalUrls['hide_connect_button']) {
330330 // Add an option to connect via Facebook Connect
331331 $personal_urls['fbconnect'] = array(
332332 'text' => wfMsg( 'fbconnect-connect' ),
@@ -336,7 +336,7 @@
337337 }
338338
339339 // Remove other personal toolbar links
340 - if ( !empty( $fbConnectOnly ) ) {
 340+ if ( !empty( $wgFbConnectOnly ) ) {
341341 foreach (array('login', 'anonlogin') as $k) {
342342 if (array_key_exists($k, $personal_urls)) {
343343 unset($personal_urls[$k]);
@@ -415,14 +415,14 @@
416416 * Special:ListUsers.
417417 */
418418 static function SpecialListusersHeaderForm( &$pager, &$out ) {
419 - global $fbUserRightsFromGroup, $facebook, $fbLogo;
420 - if ( empty($fbUserRightsFromGroup) ) {
 419+ global $wgFbUserRightsFromGroup, $facebook, $wgFbLogo;
 420+ if ( empty($wgFbUserRightsFromGroup) ) {
421421 return true;
422422 }
423423
424424 // TODO: Do we need to verify the Facebook session here?
425425
426 - $gid = $fbUserRightsFromGroup;
 426+ $gid = $wgFbUserRightsFromGroup;
427427 // Connect to the API and get some info about the group
428428 try {
429429 $group = $facebook->api('/' . $gid);
@@ -449,11 +449,11 @@
450450
451451 /**
452452 * Removes Special:UserLogin and Special:CreateAccount from the list of
453 - * special pages if $fbConnectOnly is set to true.
 453+ * special pages if $wgFbConnectOnly is set to true.
454454 */
455455 static function SpecialPage_initList( &$aSpecialPages ) {
456 - global $fbConnectOnly;
457 - if ( !empty( $fbConnectOnly) ) {
 456+ global $wgFbConnectOnly;
 457+ if ( !empty( $wgFbConnectOnly) ) {
458458 $aSpecialPages['Userlogin'] = array('SpecialRedirectToSpecial', 'UserLogin',
459459 'Connect', false, array('returnto', 'returntoquery'));
460460 // Used in 1.12.x and above
@@ -486,11 +486,11 @@
487487 }
488488
489489 /**
490 - * Removes the 'createaccount' right from users if $fbConnectOnly is true.
 490+ * Removes the 'createaccount' right from users if $wgFbConnectOnly is true.
491491 */
492492 static function UserGetRights( &$user, &$aRights ) {
493 - global $fbConnectOnly;
494 - if ( !empty( $fbConnectOnly ) ) {
 493+ global $wgFbConnectOnly;
 494+ if ( !empty( $wgFbConnectOnly ) ) {
495495 foreach ( $aRights as $i => $right ) {
496496 if ( $right == 'createaccount' ) {
497497 unset( $aRights[$i] );
Index: trunk/extensions/FBConnect/FBConnect.i18n.php
@@ -48,7 +48,7 @@
4949 'group-fb-user' => 'Facebook Connect users',
5050 'group-fb-user-member' => 'Facebook Connect user',
5151 'grouppage-fb-user' => '{{ns:project}}:Facebook Connect users',
52 -// Group for Facebook Connect users beloning to the group specified by $fbUserRightsFromGroup
 52+// Group for Facebook Connect users beloning to the group specified by $wgFbUserRightsFromGroup
5353 'group-fb-groupie' => 'Group members',
5454 'group-fb-groupie-member' => 'Group member',
5555 'grouppage-fb-groupie' => '{{ns:project}}:Group members',
Index: trunk/extensions/FBConnect/fbconnect.js
@@ -47,7 +47,7 @@
4848 window.fbAsyncInit = function() {
4949 // Initialize the library with the API key
5050 FB.init({
51 - appId : window.fbAppId, // See $fbAppId in config.php
 51+ appId : window.fbAppId, // See $wgFbAppId in config.php
5252 session: window.fbSession, // Don't re-fetch the session if PHP provides it
5353 status : true, // Check login status
5454 cookie : true, // Enable cookies to allow the server to access the session

Status & tagging log