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 @@ |
42 | 42 | * $tag argument with the $tag provided to createParserHook. |
43 | 43 | */ |
44 | 44 | static function parserHook($innertext, $args, &$parser, $tag = '' ) { |
45 | | - global $fbAllowFacebookImages; |
| 45 | + global $wgFbAllowFacebookImages; |
46 | 46 | |
47 | 47 | // Run hook to allow modifying the default behavior. If $override is |
48 | 48 | // set, it is used instead. Return false to disable the tag. |
— | — | @@ -63,17 +63,17 @@ |
64 | 64 | // Disable these tags by returning an empty string |
65 | 65 | break; |
66 | 66 | case 'fb:serverfbml': |
67 | | - // TODO: Is this safe? Does it respect $fbAllowFacebookImages? |
| 67 | + // TODO: Is this safe? Does it respect $wgFbAllowFacebookImages? |
68 | 68 | $attrs = self::implodeAttrs( $args ); |
69 | 69 | // Don't recursively parse $innertext |
70 | 70 | return "<fb:serverfbml{$attrs}>$innertext</fb:serverfbml>"; |
71 | 71 | case 'fb:profile-pic': |
72 | 72 | #case 'fb:photo': // Dropped in new JavaScript SDK |
73 | 73 | #case 'fb:video': // Dropped in new JavaScript SDK |
74 | | - if (!$fbAllowFacebookImages) { |
| 74 | + if (!$wgFbAllowFacebookImages) { |
75 | 75 | break; |
76 | 76 | } |
77 | | - // Careful - no "break;" if $fbAllowFacebookImages is true |
| 77 | + // Careful - no "break;" if $wgFbAllowFacebookImages is true |
78 | 78 | default: |
79 | 79 | // Allow other tags by default |
80 | 80 | $attrs = self::implodeAttrs( $args ); |
— | — | @@ -111,12 +111,12 @@ |
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
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. |
117 | 117 | */ |
118 | 118 | static function isEnabled() { |
119 | | - global $fbUseMarkup; |
120 | | - return !isset($fbUseMarkup) || $fbUseMarkup; |
| 119 | + global $wgFbUseMarkup; |
| 120 | + return !isset($wgFbUseMarkup) || $wgFbUseMarkup; |
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
Index: trunk/extensions/FBConnect/SpecialConnect.php |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | } |
209 | 209 | |
210 | 210 | protected function createUser($fb_id, $name) { |
211 | | - global $wgUser, $wgOut, $fbConnectOnly, $wgAuth, $wgRequest, $wgMemc; |
| 211 | + global $wgUser, $wgOut, $wgFbConnectOnly, $wgAuth, $wgRequest, $wgMemc; |
212 | 212 | wfProfileIn(__METHOD__); |
213 | 213 | |
214 | 214 | // Handle accidental reposts. |
— | — | @@ -232,8 +232,8 @@ |
233 | 233 | if ( wfReadOnly() ) { |
234 | 234 | $wgOut->readOnlyPage(); |
235 | 235 | 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 |
238 | 238 | if ( $wgUser->isBlockedFromCreateAccount() ) { |
239 | 239 | wfDebug("FBConnect: Blocked user was attempting to create account via Facebook Connect.\n"); |
240 | 240 | $wgOut->showErrorPage('fbconnect-error', 'fbconnect-errortext'); |
— | — | @@ -353,8 +353,8 @@ |
354 | 354 | } |
355 | 355 | |
356 | 356 | // Process the FBConnectPushEvent preference checkboxes if fbConnectPushEvents are enabled. |
357 | | - global $fbEnablePushToFacebook; |
358 | | - if($fbEnablePushToFacebook){ |
| 357 | + global $wgFbEnablePushToFacebook; |
| 358 | + if($wgFbEnablePushToFacebook){ |
359 | 359 | global $fbPushEventClasses; |
360 | 360 | if(!empty($fbPushEventClasses)){ |
361 | 361 | foreach($fbPushEventClasses as $pushEventClassName){ |
— | — | @@ -567,14 +567,14 @@ |
568 | 568 | */ |
569 | 569 | private function chooseNameForm($messagekey = 'fbconnect-chooseinstructions') { |
570 | 570 | // Permissions restrictions. |
571 | | - global $wgUser, $facebook, $wgOut, $fbConnectOnly; |
| 571 | + global $wgUser, $facebook, $wgOut, $wgFbConnectOnly; |
572 | 572 | $titleObj = SpecialPage::getTitleFor( 'Connect' ); |
573 | 573 | if ( wfReadOnly() ) { |
574 | 574 | // The wiki is in read-only mode |
575 | 575 | $wgOut->readOnlyPage(); |
576 | 576 | 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 |
579 | 579 | if ( $wgUser->isBlockedFromCreateAccount() ) { |
580 | 580 | wfDebug("FBConnect: Blocked user was attempting to create account via Facebook Connect.\n"); |
581 | 581 | $wgOut->showErrorPage('fbconnect-error', 'fbconnect-errortext'); |
— | — | @@ -607,8 +607,8 @@ |
608 | 608 | <fieldset id="mw-fbconnect-choosename"> |
609 | 609 | <legend>' . wfMsg('fbconnect-chooselegend') . '</legend> |
610 | 610 | <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) { |
613 | 613 | // Grab the UserName from the cookie if it exists |
614 | 614 | global $wgCookiePrefix; |
615 | 615 | $name = isset($_COOKIE[$wgCookiePrefix . 'UserName']) ? |
Index: trunk/extensions/FBConnect/FBConnectAPI.php |
— | — | @@ -33,19 +33,19 @@ |
34 | 34 | class FBConnectAPI extends Facebook { |
35 | 35 | // Constructor |
36 | 36 | public function __construct() { |
37 | | - global $fbAppId, $fbSecret, $fbDomain; |
| 37 | + global $wgFbAppId, $wgFbSecret, $wgFbDomain; |
38 | 38 | // Check to make sure config.sample.php was renamed properly |
39 | 39 | if ( !$this->isConfigSetup() ) { |
40 | | - exit( 'Please update $fbAppId and $fbSecret in config.php' ); |
| 40 | + exit( 'Please update $wgFbAppId and $wgFbSecret in config.php' ); |
41 | 41 | } |
42 | 42 | $config = array( |
43 | | - 'appId' => $fbAppId, |
44 | | - 'secret' => $fbSecret, |
| 43 | + 'appId' => $wgFbAppId, |
| 44 | + 'secret' => $wgFbSecret, |
45 | 45 | 'cookie' => true, |
46 | 46 | ); |
47 | 47 | // 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; |
50 | 50 | } |
51 | 51 | parent::__construct( $config ); |
52 | 52 | } |
— | — | @@ -56,20 +56,20 @@ |
57 | 57 | * followed correctly. |
58 | 58 | */ |
59 | 59 | 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'; |
63 | 63 | if(!$isSetup) { |
64 | 64 | // Check to see if they are still using the old variables |
65 | 65 | global $fbApiKey, $fbApiSecret; |
66 | 66 | if ( isset($fbApiKey) ) { |
67 | | - $fbAppId = $fbApiKey; |
| 67 | + $wgFbAppId = $fbApiKey; |
68 | 68 | } |
69 | 69 | if ( isset($fbApiSecret) ) { |
70 | | - $fbSecret= $fbApiSecret; |
| 70 | + $wgFbSecret= $fbApiSecret; |
71 | 71 | } |
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'; |
74 | 74 | } |
75 | 75 | return $isSetup; |
76 | 76 | } |
— | — | @@ -114,14 +114,14 @@ |
115 | 115 | * Retrieves group membership data from Facebook. |
116 | 116 | */ |
117 | 117 | public function getGroupRights( $user = null ) { |
118 | | - global $fbUserRightsFromGroup; |
| 118 | + global $wgFbUserRightsFromGroup; |
119 | 119 | |
120 | 120 | // Groupies can be members, officers or admins (the latter two infer the former) |
121 | 121 | $rights = array('member' => false, |
122 | 122 | 'officer' => false, |
123 | 123 | 'admin' => false); |
124 | 124 | |
125 | | - $gid = !empty($fbUserRightsFromGroup) ? $fbUserRightsFromGroup : false; |
| 125 | + $gid = !empty($wgFbUserRightsFromGroup) ? $wgFbUserRightsFromGroup : false; |
126 | 126 | if (// If no group ID is specified, then there's no group to belong to |
127 | 127 | !$gid || |
128 | 128 | // If $user wasn't specified, set it to the logged in user |
Index: trunk/extensions/FBConnect/FBConnect.php |
— | — | @@ -19,8 +19,6 @@ |
20 | 20 | * FBConnect plugin. Integrates Facebook Connect into MediaWiki. |
21 | 21 | * |
22 | 22 | * 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. |
25 | 23 | * |
26 | 24 | * Info is available at http://www.mediawiki.org/wiki/Extension:FBConnect |
27 | 25 | * and at http://wiki.developers.facebook.com/index.php/MediaWiki |
— | — | @@ -62,15 +60,15 @@ |
63 | 61 | * Initialization of the autoloaders and special extension pages. |
64 | 62 | */ |
65 | 63 | $dir = dirname(__FILE__) . '/'; |
66 | | -require_once $dir . 'config.php'; |
| 64 | +require_once $dir . 'config.default.php'; |
67 | 65 | 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', '<')) { |
69 | 67 | require_once $dir . 'PreferencesExtension.php'; |
70 | 68 | } |
71 | 69 | |
72 | 70 | $wgExtensionFunctions[] = 'FBConnect::init'; |
73 | 71 | |
74 | | -if( !empty( $fbEnablePushToFacebook ) ){ |
| 72 | +if( !empty( $wgFbEnablePushToFacebook ) ){ |
75 | 73 | // Need to include it explicitly instead of autoload since it has initialization code of its own. |
76 | 74 | // This should be done after FBConnect::init is added to wgExtensionFunctions so that FBConnect |
77 | 75 | // gets fully initialized first. |
— | — | @@ -98,7 +96,7 @@ |
99 | 97 | $wgGroupPermissions['fb-user'] = $wgGroupPermissions['user']; |
100 | 98 | |
101 | 99 | // If we are configured to pull group info from Facebook, then create the group permissions |
102 | | -if ($fbUserRightsFromGroup) { |
| 100 | +if ($wgFbUserRightsFromGroup) { |
103 | 101 | $wgGroupPermissions['fb-groupie'] = $wgGroupPermissions['user']; |
104 | 102 | $wgGroupPermissions['fb-officer'] = $wgGroupPermissions['bureaucrat']; |
105 | 103 | $wgGroupPermissions['fb-admin'] = $wgGroupPermissions['sysop']; |
— | — | @@ -131,7 +129,7 @@ |
132 | 130 | */ |
133 | 131 | public static function init() { |
134 | 132 | global $wgXhtmlNamespaces, $wgSharedTables, $facebook, $wgHooks; |
135 | | - global $fbOnLoginJsOverride; |
| 133 | + global $wgFbOnLoginJsOverride; |
136 | 134 | |
137 | 135 | // The xmlns:fb attribute is required for proper rendering on IE |
138 | 136 | $wgXhtmlNamespaces['fb'] = 'http://www.facebook.com/2008/fbml'; |
— | — | @@ -149,8 +147,8 @@ |
150 | 148 | } |
151 | 149 | |
152 | 150 | // Allow configurable over-riding of the onLogin handler. |
153 | | - if(!empty($fbOnLoginJsOverride)){ |
154 | | - self::$fbOnLoginJs = $fbOnLoginJsOverride; |
| 151 | + if(!empty($wgFbOnLoginJsOverride)){ |
| 152 | + self::$fbOnLoginJs = $wgFbOnLoginJsOverride; |
155 | 153 | } else { |
156 | 154 | self::$fbOnLoginJs = "window.location.reload(true);"; |
157 | 155 | } |
— | — | @@ -191,10 +189,10 @@ |
192 | 190 | * Return the code for the permissions attribute (with leading space) to use on all fb:login-buttons. |
193 | 191 | */ |
194 | 192 | public static function getPermissionsAttribute(){ |
195 | | - global $fbExtendedPermissions; |
| 193 | + global $wgFbExtendedPermissions; |
196 | 194 | $attr = ""; |
197 | | - if(!empty($fbExtendedPermissions)){ |
198 | | - $attr = " perms=\"".implode(",", $fbExtendedPermissions)."\""; |
| 195 | + if(!empty($wgFbExtendedPermissions)){ |
| 196 | + $attr = " perms=\"".implode(",", $wgFbExtendedPermissions)."\""; |
199 | 197 | } |
200 | 198 | return $attr; |
201 | 199 | } // end getPermissionsAttribute() |
— | — | @@ -212,4 +210,4 @@ |
213 | 211 | } |
214 | 212 | return $attr; |
215 | 213 | } // end getOnLoginAttribute() |
216 | | -} |
| 214 | +} |
\ No newline at end of file |
Index: trunk/extensions/FBConnect/FBConnectPushEvent.php |
— | — | @@ -36,12 +36,12 @@ |
37 | 37 | wfProfileIn(__METHOD__); |
38 | 38 | |
39 | 39 | // The push feature of the extension requires the publish_stream extended permission. |
40 | | - global $fbExtendedPermissions; |
| 40 | + global $wgFbExtendedPermissions; |
41 | 41 | $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; |
46 | 46 | } |
47 | 47 | |
48 | 48 | // Make sure that all of the push events were configured correctly. |
Index: trunk/extensions/FBConnect/FBConnectHooks.php |
— | — | @@ -62,10 +62,10 @@ |
63 | 63 | * Checks the autopromote condition for a user. |
64 | 64 | */ |
65 | 65 | static function AutopromoteCondition( $cond_type, $args, $user, &$result ) { |
66 | | - global $fbUserRightsFromGroup; |
| 66 | + global $wgFbUserRightsFromGroup; |
67 | 67 | |
68 | 68 | // Probably a redundant check, but with PHP you can never be too sure... |
69 | | - if (!$fbUserRightsFromGroup) { |
| 69 | + if (!$wgFbUserRightsFromGroup) { |
70 | 70 | // No group to pull rights from, so the user can't be a member |
71 | 71 | $result = false; |
72 | 72 | return true; |
— | — | @@ -91,16 +91,16 @@ |
92 | 92 | * Injects some important CSS and Javascript into the <head> of the page. |
93 | 93 | */ |
94 | 94 | public static function BeforePageDisplay( &$out, &$sk ) { |
95 | | - global $wgVersion, $fbLogo, $fbScript, $fbExtensionScript, $fbIncludeJquery, |
| 95 | + global $wgVersion, $wgFbLogo, $wgFbScript, $wgFbExtensionScript, $wgFbIncludeJquery, |
96 | 96 | $wgScriptPath, $wgJsMimeType, $wgStyleVersion; |
97 | 97 | |
98 | 98 | // Asynchronously load the Facebook Connect JavaScript SDK before the page's content |
99 | | - if(!empty($fbScript)){ |
| 99 | + if(!empty($wgFbScript)){ |
100 | 100 | $out->prependHTML(' |
101 | 101 | <div id="fb-root"></div> |
102 | 102 | <script> |
103 | 103 | (function(){var e=document.createElement("script");e.type="' . |
104 | | - $wgJsMimeType . '";e.src="' . $fbScript . |
| 104 | + $wgJsMimeType . '";e.src="' . $wgFbScript . |
105 | 105 | '";e.async=true;document.getElementById("fb-root").appendChild(e)})(); |
106 | 106 | </script>' . "\n" |
107 | 107 | ); |
— | — | @@ -112,18 +112,18 @@ |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Add a Facebook logo to the class .mw-fblink |
116 | | - $style = empty($fbLogo) ? '' : <<<STYLE |
| 116 | + $style = empty($wgFbLogo) ? '' : <<<STYLE |
117 | 117 | /* Add a pretty logo to Facebook links */ |
118 | 118 | .mw-fblink { |
119 | | - background: url($fbLogo) top left no-repeat !important; |
| 119 | + background: url($wgFbLogo) top left no-repeat !important; |
120 | 120 | padding-left: 17px !important; |
121 | 121 | } |
122 | 122 | STYLE; |
123 | 123 | |
124 | 124 | // Things get a little simpler in 1.16... |
125 | 125 | 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) ) { |
128 | 128 | $out->addInlineStyle($style); |
129 | 129 | } |
130 | 130 | |
— | — | @@ -133,23 +133,23 @@ |
134 | 134 | $out->addScriptFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); |
135 | 135 | |
136 | 136 | // Add the script file specified by $url |
137 | | - if(!empty($fbExtensionScript)){ |
138 | | - $out->addScriptFile($fbExtensionScript); |
| 137 | + if(!empty($wgFbExtensionScript)){ |
| 138 | + $out->addScriptFile($wgFbExtensionScript); |
139 | 139 | } |
140 | 140 | } 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) ) { |
143 | 143 | $out->addScript('<style type="text/css">' . $style . '</style>'); |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Don't include jQuery if it's already in use on the site |
147 | | - if (!empty($fbIncludeJquery)){ |
| 147 | + if (!empty($wgFbIncludeJquery)){ |
148 | 148 | $out->addScriptFile("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); |
149 | 149 | } |
150 | 150 | |
151 | 151 | // 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"); |
154 | 154 | } |
155 | 155 | } |
156 | 156 | return true; |
— | — | @@ -176,10 +176,10 @@ |
177 | 177 | /** |
178 | 178 | * Adds several Facebook Connect variables to the page: |
179 | 179 | * |
180 | | - * fbAppId The application ID (see $fbAppId in config.php) |
| 180 | + * fbAppId The application ID (see $wgFbAppId in config.php) |
181 | 181 | * 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) |
184 | 184 | * fbLogoutURL The URL to be redirected to on a disconnect |
185 | 185 | * |
186 | 186 | * This hook was added in MediaWiki version 1.14. See: |
— | — | @@ -188,11 +188,11 @@ |
189 | 189 | * to retain backward compatability. |
190 | 190 | */ |
191 | 191 | 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; |
194 | 194 | $vars['fbSession'] = $facebook->getSession(); |
195 | | - $vars['fbUseMarkup'] = $fbUseMarkup; |
196 | | - $vars['fbLogo'] = $fbLogo ? true : false; |
| 195 | + $vars['fbUseMarkup'] = $wgFbUseMarkup; |
| 196 | + $vars['fbLogo'] = $wgFbLogo ? true : false; |
197 | 197 | $vars['fbLogoutURL'] = Skin::makeSpecialUrl('Userlogout', |
198 | 198 | $wgTitle->isSpecial('Preferences') ? '' : |
199 | 199 | "returnto={$wgTitle->getPrefixedURL()}"); |
— | — | @@ -245,13 +245,13 @@ |
246 | 246 | */ |
247 | 247 | public static function PersonalUrls( &$personal_urls, &$wgTitle ) { |
248 | 248 | global $facebook, $wgUser, $wgLang, $wgShowIPinHeader; |
249 | | - global $fbPersonalUrls, $fbConnectOnly; |
| 249 | + global $wgFbPersonalUrls, $wgFbConnectOnly; |
250 | 250 | wfLoadExtensionMessages('FBConnect'); |
251 | 251 | |
252 | 252 | /* |
253 | 253 | * Personal URLs option: remove_user_talk_link |
254 | 254 | */ |
255 | | - if ($fbPersonalUrls['remove_user_talk_link'] && |
| 255 | + if ($wgFbPersonalUrls['remove_user_talk_link'] && |
256 | 256 | array_key_exists('mytalk', $personal_urls)) { |
257 | 257 | unset($personal_urls['mytalk']); |
258 | 258 | } |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | /* |
263 | 263 | * Personal URLs option: use_real_name_from_fb |
264 | 264 | */ |
265 | | - if ( !empty( $fbPersonalUrls['use_real_name_from_fb'] ) ) { |
| 265 | + if ( !empty( $wgFbPersonalUrls['use_real_name_from_fb'] ) ) { |
266 | 266 | // Start with the real name in the database |
267 | 267 | $name = $wgUser->getRealName(); |
268 | 268 | // Ask Facebook for the real name |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | } |
282 | 282 | } |
283 | 283 | // 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'] ) ){ |
285 | 285 | unset( $personal_urls['logout'] ); |
286 | 286 | $personal_urls['fblogout'] = array( |
287 | 287 | 'text' => wfMsg( 'fbconnect-logout' ), |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | /* |
293 | 293 | * Personal URLs option: link_back_to_facebook |
294 | 294 | */ |
295 | | - if ($fbPersonalUrls['link_back_to_facebook']) { |
| 295 | + if ($wgFbPersonalUrls['link_back_to_facebook']) { |
296 | 296 | try { |
297 | 297 | $fbUser = $facebook->api('/me'); |
298 | 298 | $link = $fbUser['link']; |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | /* |
313 | 313 | * Personal URLs option: hide_convert_button |
314 | 314 | */ |
315 | | - if (!$fbPersonalUrls['hide_convert_button']) { |
| 315 | + if (!$wgFbPersonalUrls['hide_convert_button']) { |
316 | 316 | $personal_urls['fbconvert'] = array( |
317 | 317 | 'text' => wfMsg( 'fbconnect-convert' ), |
318 | 318 | 'href' => SpecialConnect::getTitleFor('Connect', 'Convert')->getLocalURL( |
— | — | @@ -325,7 +325,7 @@ |
326 | 326 | /* |
327 | 327 | * Personal URLs option: hide_connect_button |
328 | 328 | */ |
329 | | - if (!$fbPersonalUrls['hide_connect_button']) { |
| 329 | + if (!$wgFbPersonalUrls['hide_connect_button']) { |
330 | 330 | // Add an option to connect via Facebook Connect |
331 | 331 | $personal_urls['fbconnect'] = array( |
332 | 332 | 'text' => wfMsg( 'fbconnect-connect' ), |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | } |
338 | 338 | |
339 | 339 | // Remove other personal toolbar links |
340 | | - if ( !empty( $fbConnectOnly ) ) { |
| 340 | + if ( !empty( $wgFbConnectOnly ) ) { |
341 | 341 | foreach (array('login', 'anonlogin') as $k) { |
342 | 342 | if (array_key_exists($k, $personal_urls)) { |
343 | 343 | unset($personal_urls[$k]); |
— | — | @@ -415,14 +415,14 @@ |
416 | 416 | * Special:ListUsers. |
417 | 417 | */ |
418 | 418 | static function SpecialListusersHeaderForm( &$pager, &$out ) { |
419 | | - global $fbUserRightsFromGroup, $facebook, $fbLogo; |
420 | | - if ( empty($fbUserRightsFromGroup) ) { |
| 419 | + global $wgFbUserRightsFromGroup, $facebook, $wgFbLogo; |
| 420 | + if ( empty($wgFbUserRightsFromGroup) ) { |
421 | 421 | return true; |
422 | 422 | } |
423 | 423 | |
424 | 424 | // TODO: Do we need to verify the Facebook session here? |
425 | 425 | |
426 | | - $gid = $fbUserRightsFromGroup; |
| 426 | + $gid = $wgFbUserRightsFromGroup; |
427 | 427 | // Connect to the API and get some info about the group |
428 | 428 | try { |
429 | 429 | $group = $facebook->api('/' . $gid); |
— | — | @@ -449,11 +449,11 @@ |
450 | 450 | |
451 | 451 | /** |
452 | 452 | * 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. |
454 | 454 | */ |
455 | 455 | static function SpecialPage_initList( &$aSpecialPages ) { |
456 | | - global $fbConnectOnly; |
457 | | - if ( !empty( $fbConnectOnly) ) { |
| 456 | + global $wgFbConnectOnly; |
| 457 | + if ( !empty( $wgFbConnectOnly) ) { |
458 | 458 | $aSpecialPages['Userlogin'] = array('SpecialRedirectToSpecial', 'UserLogin', |
459 | 459 | 'Connect', false, array('returnto', 'returntoquery')); |
460 | 460 | // Used in 1.12.x and above |
— | — | @@ -486,11 +486,11 @@ |
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
490 | | - * Removes the 'createaccount' right from users if $fbConnectOnly is true. |
| 490 | + * Removes the 'createaccount' right from users if $wgFbConnectOnly is true. |
491 | 491 | */ |
492 | 492 | static function UserGetRights( &$user, &$aRights ) { |
493 | | - global $fbConnectOnly; |
494 | | - if ( !empty( $fbConnectOnly ) ) { |
| 493 | + global $wgFbConnectOnly; |
| 494 | + if ( !empty( $wgFbConnectOnly ) ) { |
495 | 495 | foreach ( $aRights as $i => $right ) { |
496 | 496 | if ( $right == 'createaccount' ) { |
497 | 497 | unset( $aRights[$i] ); |
Index: trunk/extensions/FBConnect/FBConnect.i18n.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | 'group-fb-user' => 'Facebook Connect users', |
50 | 50 | 'group-fb-user-member' => 'Facebook Connect user', |
51 | 51 | '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 |
53 | 53 | 'group-fb-groupie' => 'Group members', |
54 | 54 | 'group-fb-groupie-member' => 'Group member', |
55 | 55 | 'grouppage-fb-groupie' => '{{ns:project}}:Group members', |
Index: trunk/extensions/FBConnect/fbconnect.js |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | window.fbAsyncInit = function() { |
49 | 49 | // Initialize the library with the API key |
50 | 50 | FB.init({ |
51 | | - appId : window.fbAppId, // See $fbAppId in config.php |
| 51 | + appId : window.fbAppId, // See $wgFbAppId in config.php |
52 | 52 | session: window.fbSession, // Don't re-fetch the session if PHP provides it |
53 | 53 | status : true, // Check login status |
54 | 54 | cookie : true, // Enable cookies to allow the server to access the session |