From 36d55526d34e8821d27079f67cbc1b923ac3155d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 23 Jan 2009 05:47:34 +0000 Subject: trac750 fix for crash when a user logs in and hasn't already posted a notice --- actions/facebookhome.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'actions') diff --git a/actions/facebookhome.php b/actions/facebookhome.php index b05e51b91..e8c10c9ed 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 { -- cgit v1.2.3-54-g00ecf From 94b926be657640f4e0306a3787add27d49c7a566 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 23 Jan 2009 06:02:41 +0000 Subject: trac750 small fix to FBJS redirect --- actions/facebooksettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') 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'); -- cgit v1.2.3-54-g00ecf From c97980b14587327a0870f872305ecdd157896385 Mon Sep 17 00:00:00 2001 From: sarven Date: Fri, 23 Jan 2009 06:14:56 +0000 Subject: Missing closing li --- actions/avatarsettings.php | 13 ++++++------- theme/base/css/display.css | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'actions') 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/theme/base/css/display.css b/theme/base/css/display.css index b4f3ffd54..4eee3449b 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -226,7 +226,7 @@ position:absolute; right:0; top:49px; float:right; -width:322px; +width:300px; } #page_notice { clear:both; -- cgit v1.2.3-54-g00ecf From 78bf36129188604e229014a1d063cd818f263a92 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 23 Jan 2009 07:09:00 +0000 Subject: trac750 fix href for theme stylesheet --- actions/facebookhome.php | 4 +- actions/facebooklogin.php | 101 ++++++++++++++++++++++++++++++++++++++++++++ scripts/update_facebook.php | 2 +- 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 actions/facebooklogin.php (limited to 'actions') diff --git a/actions/facebookhome.php b/actions/facebookhome.php index e8c10c9ed..9510e7f08 100644 --- a/actions/facebookhome.php +++ b/actions/facebookhome.php @@ -202,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 @@ +. + */ + +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 '

REDIRECT TO HOME

'; + } + } 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/scripts/update_facebook.php b/scripts/update_facebook.php index 1574b9e09..d2c1c3ffb 100755 --- a/scripts/update_facebook.php +++ b/scripts/update_facebook.php @@ -34,7 +34,7 @@ require_once INSTALLDIR . '/lib/facebookutil.php'; $last_updated_file = INSTALLDIR . '/scripts/facebook_last_updated'; // Lock file name -$tmp_file = "/tmp/update_facebook.lock"; +$tmp_file = INSTALLDIR . '/scripts/update_facebook.lock'; // Make sure only one copy of the script is running at a time if (!($tmp_file = @fopen($tmp_file, "w"))) -- cgit v1.2.3-54-g00ecf