summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/avatarsettings.php13
-rw-r--r--actions/facebookhome.php23
-rw-r--r--actions/facebooklogin.php101
-rw-r--r--actions/facebooksettings.php2
4 files changed, 120 insertions, 19 deletions
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index 1db35237e..19f53b882 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -119,9 +119,8 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementStart('ul', 'form_data');
if ($original) {
- $this->elementStart('li',
- array('id' => 'avatar_original',
- 'class' => 'avatar_view'));
+ $this->elementStart('li', array('id' => 'avatar_original',
+ 'class' => 'avatar_view'));
$this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => $original->url,
@@ -135,16 +134,16 @@ class AvatarsettingsAction extends AccountSettingsAction
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
if ($avatar) {
- $this->elementStart('li',
- array('id' => 'avatar_preview',
- 'class' => 'avatar_view'));
+ $this->elementStart('li', array('id' => 'avatar_preview',
+ 'class' => 'avatar_view'));
$this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
- $this->element('img', array('src' => $original->url,//$avatar->url,
+ $this->element('img', array('src' => $original->url,
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
$this->elementEnd('div');
+ $this->elementEnd('li');
}
$this->elementStart('li', array ('id' => 'settings_attach'));
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index b05e51b91..9510e7f08 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -57,29 +57,30 @@ class FacebookhomeAction extends FacebookAction
$this->user = $this->flink->getUser();
// If this is the first time the user has started the app
- // prompt for Facebook status update permission
- if (!$this->facebook->api_client->users_hasAppPermission('status_update')) {
+ // prompt for Facebook status update permission
+ if (!$this->facebook->api_client->users_hasAppPermission('status_update')) {
if ($this->facebook->api_client->data_getUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
- $this->getUpdatePermission();
- return;
+ FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
+ $this->getUpdatePermission();
+ return;
}
}
// Make sure the user's profile box has the lastest notice
$notice = $this->user->getCurrentNotice();
- $this->updateProfileBox($notice);
+ if ($notice) {
+ $this->updateProfileBox($notice);
+ }
- if ($this->arg('status_submit') == 'Send') {
+ if ($this->arg('status_submit') == 'Send') {
$this->saveNewNotice();
- }
+ }
// User is authenticated and has already been prompted once for
// Facebook status update permission? Then show the main page
// of the app
$this->showPage();
-
} else {
@@ -201,13 +202,13 @@ class FacebookhomeAction extends FacebookAction
$this->elementEnd('p');
$this->elementStart('form', array('method' => 'post',
- 'action' => $app_url,
+ 'action' => "$app_url/index.php",
'id' => 'facebook-skip-permissions'));
$this->elementStart('ul', array('id' => 'fb-permissions-list'));
$this->elementStart('li', array('id' => 'fb-permissions-item'));
$this->elementStart('fb:prompt-permission', array('perms' => 'status_update',
- 'next_fbjs' => 'document.setLocation(\'' . $this->app_uri . '\')'));
+ 'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/index.php" . '\')'));
$this->element('span', array('class' => 'facebook-button'),
sprintf(_('Allow %s to update my Facebook status'), $this->app_name));
$this->elementEnd('fb:prompt-permission');
diff --git a/actions/facebooklogin.php b/actions/facebooklogin.php
new file mode 100644
index 000000000..94d494a82
--- /dev/null
+++ b/actions/facebooklogin.php
@@ -0,0 +1,101 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once(INSTALLDIR.'/lib/facebookaction.php');
+
+class FacebookinviteAction extends FacebookAction
+{
+
+ function handle($args)
+ {
+ parent::handle($args);
+
+ $this->error = $error;
+
+ if ($this->flink) {
+ if (!$this->facebook->api_client->users_hasAppPermission('status_update') &&
+ $this->facebook->api_client->data_getUserPreference(
+ FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
+
+ echo '<h1>REDIRECT TO HOME</h1>';
+ }
+ } else {
+ $this->showPage();
+ }
+ }
+
+
+ function showContent()
+ {
+
+ // If the user has opted not to initially allow the app to have
+ // Facebook status update permission, store that preference. Only
+ // promt the user the first time she uses the app
+ if ($this->arg('skip')) {
+ $this->facebook->api_client->data_setUserPreference(
+ FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
+ }
+
+ if ($this->flink) {
+
+ $this->user = $this->flink->getUser();
+
+ // If this is the first time the user has started the app
+ // prompt for Facebook status update permission
+ if (!$this->facebook->api_client->users_hasAppPermission('status_update')) {
+
+ if ($this->facebook->api_client->data_getUserPreference(
+ FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
+ $this->getUpdatePermission();
+ return;
+ }
+ }
+
+ } else {
+ $this->showLoginForm();
+ }
+
+ }
+
+ function showSuccessContent()
+ {
+
+
+
+ }
+
+ function showFormContent()
+ {
+
+
+ }
+
+ function title()
+ {
+ return sprintf(_('Login'));
+ }
+
+ function redirectHome()
+ {
+
+ }
+
+}
diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php
index e40496c18..236460c1c 100644
--- a/actions/facebooksettings.php
+++ b/actions/facebooksettings.php
@@ -132,7 +132,7 @@ class FacebooksettingsAction extends FacebookAction
$this->elementStart('ul', array('id' => 'fb-permissions-list'));
$this->elementStart('li', array('id' => 'fb-permissions-item'));
$this->elementStart('fb:prompt-permission', array('perms' => 'status_update',
- 'next_fbjs' => 'document.setLocation(\'' . "$this->app_url/settings.php" . '\')'));
+ 'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/settings.php" . '\')'));
$this->element('span', array('class' => 'facebook-button'),
sprintf(_('Allow %s to update my Facebook status'), common_config('site', 'name')));
$this->elementEnd('fb:prompt-permission');