3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, 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('LACONICA')) { exit(1); }
22 require_once(INSTALLDIR.'/lib/facebookaction.php');
24 class FacebookinviteAction extends FacebookAction
27 function handle($args)
29 parent::handle($args);
31 if ($this->arg('ids')) {
32 $this->showThankYou();
34 $this->showInviteForm();
39 function showThankYou()
41 $facebook = get_facebook();
42 $fbuid = $facebook->require_login();
44 $this->showHeader('Invite');
46 $this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
47 $this->element('p', null, _('Invitations have been sent to the following users:'));
49 $friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
51 $this->elementStart("ul");
53 foreach ($friend_ids as $friend) {
54 $this->elementStart('li');
55 $this->element('fb:profile-pic', array('uid' => $friend));
56 $this->element('fb:name', array('uid' => $friend,
57 'capitalize' => 'true'));
58 $this->elementEnd('li');
61 $this->elementEnd("ul");
66 function showInviteForm()
69 $facebook = get_facebook();
70 $fbuid = $facebook->require_login();
73 $this->showNav('Invite');
75 // Get a list of users who are already using the app for exclusion
76 $exclude_ids = $facebook->api_client->friends_getAppUsers();
78 $content = _('You have been invited to Identi.ca!') .
79 htmlentities('<fb:req-choice url="http://apps.facebook.com/identica_app/" label="Add"/>');
81 $this->elementStart('fb:request-form', array('action' => 'invite.php',
84 'type' => 'Identi.ca',
85 'content' => $content));
86 $this->hidden('invite', 'true');
87 $actiontext = 'Invite your friends to use Identi.ca.';
88 $this->element('fb:multi-friend-selector', array('showborder' => 'false',
89 'actiontext' => $actiontext,
90 'exclude_ids' => implode(',', $exclude_ids),
91 'bypass' => 'cancel'));
93 $this->elementEnd('fb:request-form');
95 $this->element('h2', null, _('Friends already using Identi.ca:'));
96 $this->elementStart("ul");
98 foreach ($exclude_ids as $friend) {
99 $this->elementStart('li');
100 $this->element('fb:profile-pic', array('uid' => $friend));
101 $this->element('fb:name', array('uid' => $friend,
102 'capitalize' => 'true'));
103 $this->elementEnd('li');
106 $this->elementEnd("ul");