]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Facebook/facebooklogin.php
- Set the root of a new local conversation to a new conversation.id
[quix0rs-gnu-social.git] / plugins / Facebook / facebooklogin.php
1 <?php
2 /*
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2008, 2009, StatusNet, Inc.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 if (!defined('STATUSNET') && !defined('LACONICA')) {
21     exit(1);
22 }
23
24 require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
25
26 class FacebookinviteAction extends FacebookAction
27 {
28
29     function handle($args)
30     {
31         parent::handle($args);
32
33         $this->error = $error;
34
35         if ($this->flink) {
36             if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') &&
37                 $this->facebook->api_client->data_getUserPreference(
38                      FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
39
40                 echo '<h1>REDIRECT TO HOME</h1>';
41             }
42         } else {
43             $this->showPage();
44         }
45     }
46
47     function showContent()
48     {
49
50         // If the user has opted not to initially allow the app to have
51         // Facebook status update permission, store that preference. Only
52         // promt the user the first time she uses the app
53         if ($this->arg('skip')) {
54             $this->facebook->api_client->data_setUserPreference(
55                 FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
56         }
57
58         if ($this->flink) {
59
60             $this->user = $this->flink->getUser();
61
62             // If this is the first time the user has started the app
63              // prompt for Facebook status update permission
64              if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) {
65
66                  if ($this->facebook->api_client->data_getUserPreference(
67                          FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
68                      $this->getUpdatePermission();
69                      return;
70                  }
71              }
72
73         } else {
74             $this->showLoginForm();
75         }
76
77     }
78
79     function showSuccessContent()
80     {
81
82     }
83
84     function showFormContent()
85     {
86
87     }
88
89     function title()
90     {
91         return sprintf(_m('Login'));
92     }
93
94     function redirectHome()
95     {
96
97     }
98
99 }