]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/facebooklogin.php
define LACONICA and accept LACONICA for backwards compatibility
[quix0rs-gnu-social.git] / actions / 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')) { exit(1); }
21
22 require_once(INSTALLDIR.'/lib/facebookaction.php');
23
24 class FacebookinviteAction extends FacebookAction
25 {
26
27     function handle($args)
28     {
29         parent::handle($args);
30         
31         $this->error = $error;
32         
33         if ($this->flink) {
34             if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') &&
35                 $this->facebook->api_client->data_getUserPreference(
36                      FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
37     
38                 echo '<h1>REDIRECT TO HOME</h1>';
39             }
40         } else {   
41             $this->showPage();
42         }
43     }
44
45
46     function showContent()
47     {
48                 
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');
55         }
56
57         if ($this->flink) {
58
59             $this->user = $this->flink->getUser();
60
61             // If this is the first time the user has started the app
62              // prompt for Facebook status update permission
63              if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) {
64
65                  if ($this->facebook->api_client->data_getUserPreference(
66                          FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
67                      $this->getUpdatePermission();
68                      return;
69                  }
70              }
71             
72         } else {
73             $this->showLoginForm();
74         }
75                 
76     }
77
78     function showSuccessContent()
79     {
80
81
82
83     }
84
85     function showFormContent()
86     {
87
88  
89     }
90     
91     function title() 
92     {
93         return sprintf(_('Login'));
94     }
95     
96     function redirectHome() 
97     {
98         
99     }
100
101 }