3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET') && !defined('LACONICA')) {
24 require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
26 class FacebookinviteAction extends FacebookAction
28 function handle($args)
30 parent::handle($args);
32 $this->error = $error;
35 if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') &&
36 $this->facebook->api_client->data_getUserPreference(
37 FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
39 // @todo FIXME: Missing i18n?
40 echo '<h1>REDIRECT TO HOME</h1>';
47 function showContent()
49 // If the user has opted not to initially allow the app to have
50 // Facebook status update permission, store that preference. Only
51 // promt the user the first time she uses the app
52 if ($this->arg('skip')) {
53 $this->facebook->api_client->data_setUserPreference(
54 FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
58 $this->user = $this->flink->getUser();
60 // If this is the first time the user has started the app
61 // prompt for Facebook status update permission
62 if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) {
64 if ($this->facebook->api_client->data_getUserPreference(
65 FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
66 $this->getUpdatePermission();
71 $this->showLoginForm();
76 function showSuccessContent()
81 function showFormContent()
88 // @todo FIXME: Give a more precise description? Suggestion: "Login with Facebook Connect"
90 return sprintf(_m('Login'));
93 function redirectHome()