Permalink
Browse files

Removed defective push code

  • Loading branch information...
garbear committed Jan 5, 2012
1 parent f82d9d5 commit 206ebd8898cd6c606742fe2f7b18f2f98f863754
View
@@ -77,15 +77,7 @@
// Install the extension
$wgExtensionFunctions[] = 'FacebookInit::init';
-if( !empty( $wgFbEnablePushToFacebook ) ) {
- // Need to include it explicitly instead of autoload since it has initialization
- // code of its own. This should be done after Facebook::init is added to
- // $wgExtensionFunctions so that Facebook gets fully initialized first.
- require_once $dir . 'FacebookPushEvent.php';
-}
-
$wgExtensionMessagesFiles['Facebook'] = $dir . 'Facebook.i18n.php';
-$wgExtensionMessagesFiles['FBPushEvents'] = $dir . 'pushEvents/FBPushEvents.i18n.php';
$wgExtensionMessagesFiles['FacebookLanguage'] = $dir . 'FacebookLanguage.i18n.php';
$wgExtensionAliasesFiles['Facebook'] = $dir . 'Facebook.alias.php';
@@ -94,11 +86,9 @@
$wgAutoloadClasses['FacebookHooks'] = $dir . 'FacebookHooks.php';
$wgAutoloadClasses['FacebookInit'] = $dir . 'FacebookInit.php';
$wgAutoloadClasses['FacebookLanguage'] = $dir . 'FacebookLanguage.php';
-$wgAutoloadClasses['FacebookProfilePic'] = $dir . 'FacebookProfilePic.php';
$wgAutoloadClasses['FacebookUser'] = $dir . 'FacebookUser.php';
$wgAutoloadClasses['FacebookXFBML'] = $dir . 'FacebookXFBML.php';
$wgAutoloadClasses['SpecialConnect'] = $dir . 'SpecialConnect.php';
-$wgAutoloadClasses['ChooseNameTemplate'] = $dir . 'templates/ChooseNameTemplate.class.php';
$wgSpecialPages['Connect'] = 'SpecialConnect';
@@ -118,11 +108,6 @@
$wgImplicitGroups[] = 'fb-user'; // Hide the fb-user group from Special:Listusers
-//$wgAjaxExportList[] = 'FacebookInit::disconnectFromFB';
-//$wgAjaxExportList[] = 'SpecialConnect::getLoginButtonModal';
-//$wgAjaxExportList[] = 'SpecialConnect::ajaxModalChooseName';
-//$wgAjaxExportList[] = 'SpecialConnect::checkCreateAccount';
-
// These hooks need to be hooked up prior to init() because runhooks may be called for them before init is run.
$wgFbHooksToAddImmediately = array( 'SpecialPage_initList' );
foreach( $wgFbHooksToAddImmediately as $hookName ) {
View
@@ -72,66 +72,4 @@ public function isConfigSetup() {
}
return $isSetup;
}
-
- /*
- * Publish message on Facebook wall.
- */
- public function publishStream( $href, $description, $short, $link, $img ) {
- /*
- // Retrieve the message and substitute the params for the actual values
- $msg = wfMsg( $message_name ) ;
- foreach ($params as $key => $value) {
- $msg = str_replace($key, $value, $msg);
- }
- // If $FB_NAME isn't provided, simply blank it out
- $msg = str_replace('$FB_NAME', '', $msg);
-
- /**/
- $attachment = array(
- 'name' => $link,
- 'href' => $href,
- 'description' => $description,
- 'media' => array(array(
- 'type' => 'image',
- 'src' => $img,
- 'href' => $href,
- )),
- );
- /*
- if( count( $media ) > 0 ) {
- foreach ( $media as $value ) {
- $attachment['media'][] = $value;
- }
- }
- /**/
-
- $query = array(
- 'method' => 'stream.publish',
- 'message' => $short,
- 'attachment' => json_encode( $attachment ),
- /*
- 'action_links' => json_encode( array(
- 'text' => $link_title,
- 'href' => $link
- )),
- /**/
- );
-
- // Submit the query and decode the result
- $result = json_decode( $this->api( $query ) );
-
- if ( is_array( $result ) ) {
- // Error
- #error_log( FacebookAPIErrorCodes::$api_error_descriptions[$result] );
- error_log( "stream.publish returned error code $result->error_code" );
- return $result->error_code;
- }
- else if ( is_string( $result ) ) {
- // Success! Return value is "$UserId_$PostId"
- return 0;
- } else {
- error_log( 'stream.publish: Unknown return type: ' . gettype( $result ) );
- return -1;
- }
- }
}
View
@@ -171,8 +171,8 @@ static function LoadExtensionSchemaUpdates( $updater = null ) {
return true;
}
// Tables to add to the database
- $tables = array( 'user_fbconnect', 'fbconnect_event_stats', 'fbconnect_event_show' );
- // Sql directory inside the extension folder
+ $tables = array( 'user_fbconnect' /*, 'fbconnect_event_stats', 'fbconnect_event_show'*/ );
+ // SQL directory inside the extension folder
$sql = dirname( __FILE__ ) . '/sql';
// Extension of the table schema file (depending on the database type)
switch ( $updater !== null ? $updater->getDB()->getType() : $wgDBtype ) {
@@ -329,115 +329,6 @@ public static function PersonalUrls( &$personal_urls, &$wgTitle ) {
return true;
}
- /**
- * Modify the preferences form. At the moment, we simply turn the user name
- * into a link to the user's facebook profile.
- *
- * TODO!
- */
- public static function RenderPreferencesForm( $form, $output ) {
- //global $facebook, $wgUser;
-
- // This hook no longer seems to work...
-
- /*
- $ids = FacebookDB::getFacebookIDs($wgUser);
-
- $fb_user = $facebook->getUser();
- if( $fb_user && count($ids) > 0 && in_array( $fb_user, $ids )) {
- $html = $output->getHTML();
- $name = $wgUser->getName();
- $i = strpos( $html, $name );
- if ($i !== FALSE) {
- // If the user has a valid Facebook ID, link to the Facebook profile
- try {
- $fbUser = $facebook->api('/me');
- // Replace the old output with the new output
- $html = substr( $html, 0, $i ) .
- preg_replace("/$name/", "$name (<a href=\"$fbUser[link]\" " .
- "class='mw-userlink mw-facebookuser'>" .
- wfMsg('facebook-link-to-profile') . "</a>)",
- substr( $html, $i ), 1);
- $output->clearHTML();
- $output->addHTML( $html );
- } catch (FacebookApiException $e) {
- error_log($e);
- }
- }
- }
- /**/
- return true;
- }
-
- /**
- * Adds the class "mw-userlink" to links belonging to Connect accounts on
- * the page Special:ListUsers.
- */
- static function SpecialListusersFormatRow( &$item, $row ) {
- global $fbSpecialUsers;
-
- // Only modify Facebook Connect users
- if (empty( $fbSpecialUsers ) ||
- !count(FacebookDB::getFacebookIDs(User::newFromName($row->user_name)))) {
- return true;
- }
-
- // Look to see if class="..." appears in the link
- $regs = array();
- preg_match( '/^([^>]*?)class=(["\'])([^"]*)\2(.*)/', $item, $regs );
- if (count( $regs )) {
- // If so, append " mw-userlink" to the end of the class list
- $item = $regs[1] . "class=$regs[2]$regs[3] mw-userlink$regs[2]" . $regs[4];
- } else {
- // Otherwise, stick class="mw-userlink" into the link just before the '>'
- preg_match( '/^([^>]*)(.*)/', $item, $regs );
- $item = $regs[1] . ' class="mw-userlink"' . $regs[2];
- }
- return true;
- }
-
- /**
- * Adds some info about the governing Facebook group to the header form of
- * Special:ListUsers.
- */
- // r274: Fix error with PHP 5.3 involving parameter references (thanks, PChott)
- static function SpecialListusersHeaderForm( $pager, &$out ) {
- global $wgFbUserRightsFromGroup, $facebook;
-
- if ( empty( $wgFbUserRightsFromGroup ) ) {
- return true;
- }
-
- // TODO: Do we need to verify the Facebook session here?
-
- /*
- $gid = $wgFbUserRightsFromGroup;
- // Connect to the API and get some info about the group
- try {
- $group = $facebook->api('/' . $gid);
- } catch (FacebookApiException $e) {
- error_log($e);
- return true;
- }
- $out .= '
- <table style="border-collapse: collapse;">
- <tr>
- <td>
- ' . wfMsgWikiHtml( 'facebook-listusers-header',
- wfMsg( 'group-bureaucrat-member' ), wfMsg( 'group-sysop-member' ),
- "<a href=\"http://www.facebook.com/group.php?gid=$gid\">$group[name]</a>",
- "<a href=\"http://www.facebook.com/profile.php?id={$group['owner']['id']}\" " .
- "class=\"mw-userlink\">{$group['owner']['name']}</a>") . "
- </td>
- <td>
- <img src=\"https://graph.facebook.com/$gid/picture?type=large\" title=\"$group[name]\" alt=\"$group[name]\">
- </td>
- </tr>
- </table>";
- */
- return true;
- }
-
/**
* Removes Special:UserLogin and Special:CreateAccount from the list of
* special pages if $wgFbDisableLogin is set to true.
@@ -573,117 +464,4 @@ static function UserLoadAfterLoadFromSession( $user ) {
}
return true;
}
-
- /**
- * Called when the user is logged out to log them out of Facebook as well.
- *
- static function UserLogoutComplete( &$user, &$inject_html, $old_name ) {
- global $wgTitle, $facebook;
- if ( $wgTitle->isSpecial('Userlogout') && $facebook->getUser() ) {
- // Only log the user out if it's the right user
- $fbUser = new FacebookUser();
- if ( $fbUser->getMWUser()->getName() == $old_name ) {
- $facebook->destroySession();
- }
- }
- return true;
- }
-
- /**
- * Create a disconnect button and other things in preferences.
- */
- static function initPreferencesExtensionForm( $user, &$preferences ) {
- global $wgOut, $wgJsMimeType, $wgExtensionsPath, $wgStyleVersion, $wgBlankImgUrl;
- $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/Facebook/prefs.js?{$wgStyleVersion}\"></script>\n");
- wfLoadExtensionMessages('Facebook');
- $prefsection = 'facebook-prefstext';
-
- $id = FacebookDB::getFacebookIDs($user, DB_MASTER);
- if( count($id) > 0 ) {
- $html = Xml::openElement("div",array("id" => "fbDisconnectLink" ));
- $html .= wfMsg('facebook-disconnect-link');
- $html .= Xml::closeElement( "div" );
-
- $html .= Xml::openElement("div",array("style" => "display:none","id" => "fbDisconnectProgress" ));
- $html .= wfMsg('facebook-disconnect-done');
- $html .= Xml::openElement("img",array("id" => "fbDisconnectProgressImg", 'src' => $wgBlankImgUrl, "class" => "sprite progress" ),true);
- $html .= Xml::closeElement( "div" );
-
- $html .= Xml::openElement("div",array("style" => "display:none","id" => "fbDisconnectDone" ));
- $html .= wfMsg('facebook-disconnect-info');
- $html .= Xml::closeElement( "div" );
-
- $preferences['facebook-prefstext'] = array(
- 'label' => '',
- 'type' => 'info',
- 'section' => 'facebook-prefstext/facebook-event-prefstext',
- );
-
- $preferences['tog-facebook-push-allow-never'] = array(
- 'name' => 'toggle',
- 'label-message' => 'facebook-push-allow-never',
- 'section' => 'facebook-prefstext/facebook-event-prefstext',
- );
-
- $preferences['facebook-connect'] = array(
- 'help' => $html,
- 'label' => '',
- 'type' => 'info',
- 'section' => 'facebook-prefstext/facebook-event-prefstext',
- );
-
- } else {
- // User is a MediaWiki user but isn't connected yet
- // Display a message and button to connect
- $loginButton = '<fb:login-button id="fbPrefsConnect" ' .
- FacebookInit::getPermissionsAttribute() . '></fb:login-button>';
- $html = wfMsg('facebook-convert') . '<br/>' . $loginButton;
- $html .= "<!-- Convert button -->\n";
- $preferences['facebook-disconnect'] = array(
- 'help' => $html,
- 'label' => '',
- 'type' => 'info',
- 'section' => 'facebook-prefstext/facebook-event-prefstext',
- );
- }
- return true;
- }
-
- /**
- * Add Facebook HTML to AJAX script.
- */
- public static function afterAjaxLoginHTML( &$html ) {
- $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
- wfLoadExtensionMessages('Facebook');
- if ( !LoginForm::getLoginToken() ) {
- LoginForm::setLoginToken();
- }
- $tmpl->set( 'loginToken', LoginForm::getLoginToken() );
- $tmpl->set( 'fbButtton', FacebookInit::getFBButton( 'sendToConnectOnLoginForSpecificForm();', 'fbPrefsConnect' ) );
- $html = $tmpl->execute( 'ajaxLoginMerge' );
- return true;
- }
-
- // TODO
- public static function SkinTemplatePageBeforeUserMsg(&$msg) {
- global $wgRequest, $wgUser, $wgServer, $facebook;
- wfLoadExtensionMessages('Facebook');
- $pref = Title::newFromText('Preferences', NS_SPECIAL);
- if ($wgRequest->getVal('fbconnected', '') == 1) {
- $id = FacebookDB::getFacebookIDs($wgUser, DB_MASTER);
- if( count($id) > 0 ) {
- // TODO
- $msg = Xml::element("img", array("id" => "fbMsgImage", "src" => $wgServer.'/skins/common/fbconnect/fbiconbig.png' ));
- $msg .= "<p>".wfMsg('facebook-connect-msg', array("$1" => $pref->getFullUrl() ))."</p>";
- }
- }
- // TODO
- if ($wgRequest->getVal('fbconnected', '') == 2) {
- if( strlen($facebook->getUser()) < 1 ) {
- $msg = Xml::element("img", array("id" => "fbMsgImage", "src" => $wgServer.'/skins/common/fbconnect/fbiconbig.png' ));
- $msg .= "<p>".wfMsgExt('facebook-connect-error-msg', 'parse', array("$1" => $pref->getFullUrl() ))."</p>";
- }
- }
- return true;
- }
}
View
@@ -78,23 +78,4 @@ public static function enumMethods( $className ) {
}
return $hooks;
}
-
- /**
- * Return the code for the permissions attribute (with leading space) to use on all fb:login-buttons.
- */
- public static function getPermissionsAttribute() {
- global $wgFbExtendedPermissions;
- $attr = '';
- if (!empty($wgFbExtendedPermissions)) {
- $attr = ' perms="' . implode( ',', $wgFbExtendedPermissions ) . '"';
- }
- return $attr;
- }
-
- public static function getFBButton( $onload = '', $id = '' ) {
- global $wgFbExtendedPermissions;
- return '<fb:login-button length="short" size="large" onlogin="' . $onload .
- '" perms="' . implode( ',', $wgFbExtendedPermissions ) . '" id="' . $id .
- '">' . wfMsg('fbconnect-log-in') . '</fb:login-button>';
- }
}
Oops, something went wrong.

0 comments on commit 206ebd8

Please sign in to comment.