forked from GNUsocial/gnu-social
* L10n i18n update
* add translator hints * update whitespace * added a bunch of @todos.
This commit is contained in:
parent
ecafae8472
commit
74785c64f8
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @todo Add header and documentation
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -13,13 +16,11 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
*/
|
*/
|
||||||
class FBC_XDReceiverAction extends Action
|
class FBC_XDReceiverAction extends Action
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do we need to write to the database?
|
* Do we need to write to the database?
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadonly()
|
function isReadonly()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -32,7 +33,6 @@ class FBC_XDReceiverAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
// Parent handling, including cache check
|
// Parent handling, including cache check
|
||||||
@ -63,6 +63,4 @@ class FBC_XDReceiverAction extends Action
|
|||||||
|
|
||||||
$this->elementEnd('html');
|
$this->elementEnd('html');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,10 @@ class FBConnectauthAction extends Action
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (common_is_real_login()) {
|
if (common_is_real_login()) {
|
||||||
|
|
||||||
// User is already logged in. Does she already have a linked Facebook acct?
|
// User is already logged in. Does she already have a linked Facebook acct?
|
||||||
$flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
|
$flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
|
||||||
|
|
||||||
if (!empty($flink)) {
|
if (!empty($flink)) {
|
||||||
|
|
||||||
// User already has a linked Facebook account and shouldn't be here
|
// User already has a linked Facebook account and shouldn't be here
|
||||||
common_debug('Facebook Connect Plugin - ' .
|
common_debug('Facebook Connect Plugin - ' .
|
||||||
'There is already a local user (' . $flink->user_id .
|
'There is already a local user (' . $flink->user_id .
|
||||||
@ -74,8 +72,7 @@ class FBConnectauthAction extends Action
|
|||||||
// We don't want these cookies
|
// We don't want these cookies
|
||||||
getFacebook()->clear_cookie_state();
|
getFacebook()->clear_cookie_state();
|
||||||
|
|
||||||
$this->clientError(_m('There is already a local user linked with this Facebook.'));
|
$this->clientError(_m('There is already a local user linked with this Facebook account.'));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// User came from the Facebook connect settings tab, and
|
// User came from the Facebook connect settings tab, and
|
||||||
@ -102,7 +99,7 @@ class FBConnectauthAction extends Action
|
|||||||
} else {
|
} else {
|
||||||
common_debug('Facebook Connect Plugin - ' .
|
common_debug('Facebook Connect Plugin - ' .
|
||||||
print_r($this->args, true));
|
print_r($this->args, true));
|
||||||
$this->showForm(_m('Something weird happened.'),
|
$this->showForm(_m('An unknown error has occured.'),
|
||||||
$this->trimmed('newname'));
|
$this->trimmed('newname'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -116,12 +113,14 @@ class FBConnectauthAction extends Action
|
|||||||
$this->element('div', array('class' => 'error'), $this->error);
|
$this->element('div', array('class' => 'error'), $this->error);
|
||||||
} else {
|
} else {
|
||||||
$this->element('div', 'instructions',
|
$this->element('div', 'instructions',
|
||||||
|
// TRANS: %s is the site name.
|
||||||
sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
|
sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Page title.
|
||||||
return _m('Facebook Account Setup');
|
return _m('Facebook Account Setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +154,7 @@ class FBConnectauthAction extends Action
|
|||||||
'class' => 'form_settings',
|
'class' => 'form_settings',
|
||||||
'action' => common_local_url('FBConnectAuth')));
|
'action' => common_local_url('FBConnectAuth')));
|
||||||
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
|
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
|
||||||
|
// TRANS: Legend.
|
||||||
$this->element('legend', null, _m('Connection options'));
|
$this->element('legend', null, _m('Connection options'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
@ -164,7 +164,8 @@ class FBConnectauthAction extends Action
|
|||||||
'name' => 'license',
|
'name' => 'license',
|
||||||
'value' => 'true'));
|
'value' => 'true'));
|
||||||
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
|
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
|
||||||
$message = _('My text and files are available under %s ' .
|
// TRANS: %s is the name of the license used by the user for their status updates.
|
||||||
|
$message = _m('My text and files are available under %s ' .
|
||||||
'except this private data: password, ' .
|
'except this private data: password, ' .
|
||||||
'email address, IM address, and phone number.');
|
'email address, IM address, and phone number.');
|
||||||
$link = '<a href="' .
|
$link = '<a href="' .
|
||||||
@ -180,33 +181,39 @@ class FBConnectauthAction extends Action
|
|||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
$this->element('legend', null,
|
$this->element('legend', null,
|
||||||
|
// TRANS: Legend.
|
||||||
_m('Create new account'));
|
_m('Create new account'));
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
_m('Create a new user with this nickname.'));
|
_m('Create a new user with this nickname.'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
|
// TRANS: Field label.
|
||||||
$this->input('newname', _m('New nickname'),
|
$this->input('newname', _m('New nickname'),
|
||||||
($this->username) ? $this->username : '',
|
($this->username) ? $this->username : '',
|
||||||
_m('1-64 lowercase letters or numbers, no punctuation or spaces'));
|
_m('1-64 lowercase letters or numbers, no punctuation or spaces'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->submit('create', _m('Create'));
|
// TRANS: Submit button.
|
||||||
|
$this->submit('create', _m('BUTTON','Create'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
|
// TRANS: Legend.
|
||||||
$this->element('legend', null,
|
$this->element('legend', null,
|
||||||
_m('Connect existing account'));
|
_m('Connect existing account'));
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
|
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
|
// TRANS: Field label.
|
||||||
$this->input('nickname', _m('Existing nickname'));
|
$this->input('nickname', _m('Existing nickname'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->password('password', _m('Password'));
|
$this->password('password', _m('Password'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->submit('connect', _m('Connect'));
|
// TRANS: Submit button.
|
||||||
|
$this->submit('connect', _m('BUTTON','Connect'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
@ -222,6 +229,7 @@ class FBConnectauthAction extends Action
|
|||||||
function createNewUser()
|
function createNewUser()
|
||||||
{
|
{
|
||||||
if (common_config('site', 'closed')) {
|
if (common_config('site', 'closed')) {
|
||||||
|
// TRANS: Client error trying to register with registrations not allowed.
|
||||||
$this->clientError(_m('Registration not allowed.'));
|
$this->clientError(_m('Registration not allowed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -231,6 +239,7 @@ class FBConnectauthAction extends Action
|
|||||||
if (common_config('site', 'inviteonly')) {
|
if (common_config('site', 'inviteonly')) {
|
||||||
$code = $_SESSION['invitecode'];
|
$code = $_SESSION['invitecode'];
|
||||||
if (empty($code)) {
|
if (empty($code)) {
|
||||||
|
// TRANS: Client error trying to register with registrations 'invite only'.
|
||||||
$this->clientError(_m('Registration not allowed.'));
|
$this->clientError(_m('Registration not allowed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -238,6 +247,7 @@ class FBConnectauthAction extends Action
|
|||||||
$invite = Invitation::staticGet($code);
|
$invite = Invitation::staticGet($code);
|
||||||
|
|
||||||
if (empty($invite)) {
|
if (empty($invite)) {
|
||||||
|
// TRANS: Client error trying to register with an invalid invitation code.
|
||||||
$this->clientError(_m('Not a valid invitation code.'));
|
$this->clientError(_m('Not a valid invitation code.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -422,8 +432,9 @@ class FBConnectauthAction extends Action
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given a string, try to make it work as a nickname
|
/**
|
||||||
|
* Given a string, try to make it work as a nickname
|
||||||
|
*/
|
||||||
function nicknamize($str)
|
function nicknamize($str)
|
||||||
{
|
{
|
||||||
$str = preg_replace('/\W/', '', $str);
|
$str = preg_replace('/\W/', '', $str);
|
||||||
@ -467,5 +478,4 @@ class FBConnectauthAction extends Action
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ class FBConnectLoginAction extends Action
|
|||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Instructions.
|
||||||
return _m('Login with your Facebook Account');
|
return _m('Login with your Facebook Account');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ class FBConnectLoginAction extends Action
|
|||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Page title.
|
||||||
return _m('Facebook Login');
|
return _m('Facebook Login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php';
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FBConnectSettingsAction extends ConnectSettingsAction
|
class FBConnectSettingsAction extends ConnectSettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -52,6 +51,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
|
|||||||
*/
|
*/
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Page title.
|
||||||
return _m('Facebook Connect Settings');
|
return _m('Facebook Connect Settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
|
|||||||
*/
|
*/
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Instructions.
|
||||||
return _m('Manage how your account connects to Facebook');
|
return _m('Manage how your account connects to Facebook');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
|
|||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
|
|
||||||
|
// TRANS: Legend.
|
||||||
$this->element('legend', null, _m('Disconnect my account from Facebook'));
|
$this->element('legend', null, _m('Disconnect my account from Facebook'));
|
||||||
|
|
||||||
if (!$user->password) {
|
if (!$user->password) {
|
||||||
@ -139,7 +141,8 @@ class FBConnectSettingsAction extends ConnectSettingsAction
|
|||||||
$this->element('p', 'instructions',
|
$this->element('p', 'instructions',
|
||||||
sprintf($note, $site, $site));
|
sprintf($note, $site, $site));
|
||||||
|
|
||||||
$this->submit('disconnect', _m('Disconnect'));
|
// TRANS: Submit button.
|
||||||
|
$this->submit('disconnect', _m('BUTTON','Disconnect'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
@ -196,6 +199,5 @@ class FBConnectSettingsAction extends ConnectSettingsAction
|
|||||||
$this->showForm(_m('Not sure what you\'re trying to do.'));
|
$this->showForm(_m('Not sure what you\'re trying to do.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,8 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FacebookPlugin extends Plugin
|
class FacebookPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = STATUSNET_VERSION;
|
const VERSION = STATUSNET_VERSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +57,6 @@ class FacebookPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
// Allow the key and secret to be passed in
|
// Allow the key and secret to be passed in
|
||||||
// Control panel will override
|
// Control panel will override
|
||||||
|
|
||||||
if (isset($this->apikey)) {
|
if (isset($this->apikey)) {
|
||||||
$key = common_config('facebook', 'apikey');
|
$key = common_config('facebook', 'apikey');
|
||||||
if (empty($key)) {
|
if (empty($key)) {
|
||||||
@ -85,7 +82,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean result
|
* @return boolean result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function hasKeys()
|
static function hasKeys()
|
||||||
{
|
{
|
||||||
$apiKey = common_config('facebook', 'apikey');
|
$apiKey = common_config('facebook', 'apikey');
|
||||||
@ -107,13 +103,11 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartInitializeRouter($m)
|
function onStartInitializeRouter($m)
|
||||||
{
|
{
|
||||||
$m->connect('admin/facebook', array('action' => 'facebookadminpanel'));
|
$m->connect('admin/facebook', array('action' => 'facebookadminpanel'));
|
||||||
|
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
|
|
||||||
// Facebook App stuff
|
// Facebook App stuff
|
||||||
|
|
||||||
$m->connect('facebook/app', array('action' => 'facebookhome'));
|
$m->connect('facebook/app', array('action' => 'facebookhome'));
|
||||||
@ -142,7 +136,6 @@ class FacebookPlugin extends Plugin
|
|||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
switch ($cls) {
|
switch ($cls) {
|
||||||
@ -183,7 +176,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndAdminPanelNav($nav)
|
function onEndAdminPanelNav($nav)
|
||||||
{
|
{
|
||||||
if (AdminPanelAction::canAdmin('facebook')) {
|
if (AdminPanelAction::canAdmin('facebook')) {
|
||||||
@ -192,7 +184,9 @@ class FacebookPlugin extends Plugin
|
|||||||
|
|
||||||
$nav->out->menuItem(
|
$nav->out->menuItem(
|
||||||
common_local_url('facebookadminpanel'),
|
common_local_url('facebookadminpanel'),
|
||||||
_m('Facebook'),
|
// TRANS: Menu item.
|
||||||
|
_m('MENU','Facebook'),
|
||||||
|
// TRANS: Tooltip for menu item "Facebook".
|
||||||
_m('Facebook integration configuration'),
|
_m('Facebook integration configuration'),
|
||||||
$action_name == 'facebookadminpanel',
|
$action_name == 'facebookadminpanel',
|
||||||
'nav_facebook_admin_panel'
|
'nav_facebook_admin_panel'
|
||||||
@ -210,12 +204,9 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartShowHTML($action)
|
function onStartShowHTML($action)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->reqFbScripts($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
|
|
||||||
// XXX: Horrible hack to make Safari, FF2, and Chrome work with
|
// XXX: Horrible hack to make Safari, FF2, and Chrome work with
|
||||||
// Facebook Connect. These browser cannot use Facebook's
|
// Facebook Connect. These browser cannot use Facebook's
|
||||||
// DOM parsing routines unless the mime type of the page is
|
// DOM parsing routines unless the mime type of the page is
|
||||||
@ -238,9 +229,7 @@ class FacebookPlugin extends Plugin
|
|||||||
'lang' => $language));
|
'lang' => $language));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +244,6 @@ class FacebookPlugin extends Plugin
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndShowScripts($action)
|
function onEndShowScripts($action)
|
||||||
{
|
{
|
||||||
if ($this->reqFbScripts($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
@ -306,12 +294,10 @@ class FacebookPlugin extends Plugin
|
|||||||
$js = sprintf($js, $apikey, $login_url, $logout_url);
|
$js = sprintf($js, $apikey, $login_url, $logout_url);
|
||||||
|
|
||||||
// Compress the bugger down a bit
|
// Compress the bugger down a bit
|
||||||
|
|
||||||
$js = str_replace(' ', '', $js);
|
$js = str_replace(' ', '', $js);
|
||||||
|
|
||||||
$action->inlineScript($js);
|
$action->inlineScript($js);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,7 +309,6 @@ class FacebookPlugin extends Plugin
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndShowFooter($action)
|
function onEndShowFooter($action)
|
||||||
{
|
{
|
||||||
if ($this->reqFbScripts($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
@ -340,7 +325,6 @@ class FacebookPlugin extends Plugin
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndShowStatusNetStyles($action)
|
function onEndShowStatusNetStyles($action)
|
||||||
{
|
{
|
||||||
if ($this->reqFbScripts($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
@ -357,7 +341,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function reqFbScripts($action)
|
function reqFbScripts($action)
|
||||||
{
|
{
|
||||||
if (!self::hasKeys()) {
|
if (!self::hasKeys()) {
|
||||||
@ -365,7 +348,6 @@ class FacebookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If you're logged in w/FB Connect, you always need the FB stuff
|
// If you're logged in w/FB Connect, you always need the FB stuff
|
||||||
|
|
||||||
$fbuid = $this->loggedIn();
|
$fbuid = $this->loggedIn();
|
||||||
|
|
||||||
if (!empty($fbuid)) {
|
if (!empty($fbuid)) {
|
||||||
@ -373,7 +355,6 @@ class FacebookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of actions that require FB stuff
|
// List of actions that require FB stuff
|
||||||
|
|
||||||
$needy = array('FBConnectLoginAction',
|
$needy = array('FBConnectLoginAction',
|
||||||
'FBConnectauthAction',
|
'FBConnectauthAction',
|
||||||
'FBConnectSettingsAction');
|
'FBConnectSettingsAction');
|
||||||
@ -383,7 +364,6 @@ class FacebookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -391,7 +371,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return mixed $fbuid the Facebook ID of the logged in user, or null
|
* @return mixed $fbuid the Facebook ID of the logged in user, or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function loggedIn()
|
function loggedIn()
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
@ -403,12 +382,9 @@ class FacebookPlugin extends Plugin
|
|||||||
$fbuid = 0;
|
$fbuid = 0;
|
||||||
|
|
||||||
if (!empty($flink)) {
|
if (!empty($flink)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$facebook = getFacebook();
|
$facebook = getFacebook();
|
||||||
$fbuid = $facebook->get_loggedin_user();
|
$fbuid = $facebook->get_loggedin_user();
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_WARNING, 'Facebook Connect Plugin - ' .
|
common_log(LOG_WARNING, 'Facebook Connect Plugin - ' .
|
||||||
'Problem getting Facebook user: ' .
|
'Problem getting Facebook user: ' .
|
||||||
@ -432,17 +408,14 @@ class FacebookPlugin extends Plugin
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartPrimaryNav($action)
|
function onStartPrimaryNav($action)
|
||||||
{
|
{
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
||||||
$fbuid = $this->loggedIn();
|
$fbuid = $this->loggedIn();
|
||||||
|
|
||||||
if (!empty($fbuid)) {
|
if (!empty($fbuid)) {
|
||||||
|
|
||||||
/* Default FB silhouette pic for FB users who haven't
|
/* Default FB silhouette pic for FB users who haven't
|
||||||
uploaded a profile pic yet. */
|
uploaded a profile pic yet. */
|
||||||
|
|
||||||
@ -455,7 +428,7 @@ class FacebookPlugin extends Plugin
|
|||||||
|
|
||||||
$action->element('img', array('id' => 'fbc_profile-pic',
|
$action->element('img', array('id' => 'fbc_profile-pic',
|
||||||
'src' => (!empty($url)) ? $url : $silhouetteUrl,
|
'src' => (!empty($url)) ? $url : $silhouetteUrl,
|
||||||
'alt' => 'Facebook Connect User',
|
'alt' => _m('Facebook Connect User'),
|
||||||
'width' => '16'), '');
|
'width' => '16'), '');
|
||||||
|
|
||||||
$iconurl = common_path('plugins/Facebook/fbfavicon.ico');
|
$iconurl = common_path('plugins/Facebook/fbfavicon.ico');
|
||||||
@ -477,18 +450,20 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndLoginGroupNav(&$action)
|
function onEndLoginGroupNav(&$action)
|
||||||
{
|
{
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
|
|
||||||
$action_name = $action->trimmed('action');
|
$action_name = $action->trimmed('action');
|
||||||
|
|
||||||
$action->menuItem(common_local_url('FBConnectLogin'),
|
$action->menuItem(common_local_url('FBConnectLogin'),
|
||||||
_m('Facebook'),
|
// @todo CHECKME: Should be 'Facebook Login'?
|
||||||
|
// TRANS: Menu item.
|
||||||
|
_m('MENU','Facebook'),
|
||||||
|
// TRANS: Tooltip for menu item "Facebook".
|
||||||
_m('Login or register using Facebook'),
|
_m('Login or register using Facebook'),
|
||||||
'FBConnectLogin' === $action_name);
|
'FBConnectLogin' === $action_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,18 +474,20 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndConnectSettingsNav(&$action)
|
function onEndConnectSettingsNav(&$action)
|
||||||
{
|
{
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
|
|
||||||
$action_name = $action->trimmed('action');
|
$action_name = $action->trimmed('action');
|
||||||
|
|
||||||
$action->menuItem(common_local_url('FBConnectSettings'),
|
$action->menuItem(common_local_url('FBConnectSettings'),
|
||||||
_m('Facebook'),
|
// @todo CHECKME: Should be 'Facebook Connect'?
|
||||||
|
// TRANS: Menu item tab.
|
||||||
|
_m('MENU','Facebook'),
|
||||||
|
// TRANS: Tooltip for menu item "Facebook".
|
||||||
_m('Facebook Connect Settings'),
|
_m('Facebook Connect Settings'),
|
||||||
$action_name === 'FBConnectSettings');
|
$action_name === 'FBConnectSettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +498,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartLogout($action)
|
function onStartLogout($action)
|
||||||
{
|
{
|
||||||
if (self::hasKeys()) {
|
if (self::hasKeys()) {
|
||||||
@ -550,14 +526,12 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return string $url the url for the user's Facebook avatar
|
* @return string $url the url for the user's Facebook avatar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getProfilePicURL($fbuid)
|
function getProfilePicURL($fbuid)
|
||||||
{
|
{
|
||||||
$facebook = getFacebook();
|
$facebook = getFacebook();
|
||||||
$url = null;
|
$url = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$fqry = 'SELECT pic_square FROM user WHERE uid = %s';
|
$fqry = 'SELECT pic_square FROM user WHERE uid = %s';
|
||||||
|
|
||||||
$result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid));
|
$result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid));
|
||||||
@ -582,7 +556,6 @@ class FacebookPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartEnqueueNotice($notice, &$transports)
|
function onStartEnqueueNotice($notice, &$transports)
|
||||||
{
|
{
|
||||||
if (self::hasKeys() && $notice->isLocal()) {
|
if (self::hasKeys() && $notice->isLocal()) {
|
||||||
@ -613,14 +586,14 @@ class FacebookPlugin extends Plugin
|
|||||||
'version' => self::VERSION,
|
'version' => self::VERSION,
|
||||||
'author' => 'Zach Copley',
|
'author' => 'Zach Copley',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Facebook',
|
'homepage' => 'http://status.net/wiki/Plugin:Facebook',
|
||||||
|
// TRANS: Plugin description.
|
||||||
'rawdescription' => _m(
|
'rawdescription' => _m(
|
||||||
'The Facebook plugin allows you to integrate ' .
|
'The Facebook plugin allows integrating ' .
|
||||||
'your StatusNet instance with ' .
|
'StatusNet instances with ' .
|
||||||
'<a href="http://facebook.com/">Facebook</a> ' .
|
'<a href="http://facebook.com/">Facebook</a> ' .
|
||||||
'and Facebook Connect.'
|
'and Facebook Connect.'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php';
|
|||||||
|
|
||||||
class FacebookAction extends Action
|
class FacebookAction extends Action
|
||||||
{
|
{
|
||||||
|
|
||||||
var $facebook = null;
|
var $facebook = null;
|
||||||
var $fbuid = null;
|
var $fbuid = null;
|
||||||
var $flink = null;
|
var $flink = null;
|
||||||
@ -102,7 +101,6 @@ class FacebookAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function startHTML($type=null)
|
function startHTML($type=null)
|
||||||
{
|
{
|
||||||
$this->showStylesheets();
|
$this->showStylesheets();
|
||||||
@ -143,7 +141,6 @@ class FacebookAction extends Action
|
|||||||
|
|
||||||
function showHead($error, $success)
|
function showHead($error, $success)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$this->element("h1", null, $error);
|
$this->element("h1", null, $error);
|
||||||
}
|
}
|
||||||
@ -168,7 +165,10 @@ class FacebookAction extends Action
|
|||||||
$this->elementStart('li', array('class' =>
|
$this->elementStart('li', array('class' =>
|
||||||
($this->action == 'facebookhome') ? 'current' : 'facebook_home'));
|
($this->action == 'facebookhome') ? 'current' : 'facebook_home'));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' => 'index.php', 'title' => _m('Home')), _m('Home'));
|
// TRANS: Link description for 'Home' link that leads to a start page.
|
||||||
|
array('href' => 'index.php', 'title' => _m('MENU','Home')),
|
||||||
|
// TRANS: Tooltip for 'Home' link that leads to a start page.
|
||||||
|
_m('Home'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
if (common_config('invite', 'enabled')) {
|
if (common_config('invite', 'enabled')) {
|
||||||
@ -176,7 +176,10 @@ class FacebookAction extends Action
|
|||||||
array('class' =>
|
array('class' =>
|
||||||
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
|
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite'));
|
// TRANS: Link description for 'Invite' link that leads to a page where friends can be invited.
|
||||||
|
array('href' => 'invite.php', 'title' => _m('MENU','Invite')),
|
||||||
|
// TRANS: Tooltip for 'Invite' link that leads to a page where friends can be invited.
|
||||||
|
_m('Invite'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +188,10 @@ class FacebookAction extends Action
|
|||||||
($this->action == 'facebooksettings') ? 'current' : 'facebook_settings'));
|
($this->action == 'facebooksettings') ? 'current' : 'facebook_settings'));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' => 'settings.php',
|
array('href' => 'settings.php',
|
||||||
'title' => _m('Settings')), _m('Settings'));
|
// TRANS: Link description for 'Settings' link that leads to a page user preferences can be set.
|
||||||
|
'title' => _m('MENU','Settings')),
|
||||||
|
// TRANS: Tooltip for 'Settings' link that leads to a page user preferences can be set.
|
||||||
|
_m('Settings'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
@ -272,7 +278,8 @@ class FacebookAction extends Action
|
|||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
$this->submit('submit', _m('Login'));
|
// TRANS: Login button.
|
||||||
|
$this->submit('submit', _m('BUTTON','Login'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
|
||||||
@ -283,7 +290,6 @@ class FacebookAction extends Action
|
|||||||
|
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateProfileBox($notice)
|
function updateProfileBox($notice)
|
||||||
@ -356,7 +362,6 @@ class FacebookAction extends Action
|
|||||||
|
|
||||||
function saveNewNotice()
|
function saveNewNotice()
|
||||||
{
|
{
|
||||||
|
|
||||||
$user = $this->flink->getUser();
|
$user = $this->flink->getUser();
|
||||||
|
|
||||||
$content = $this->trimmed('status_textarea');
|
$content = $this->trimmed('status_textarea');
|
||||||
@ -368,6 +373,7 @@ class FacebookAction extends Action
|
|||||||
$content_shortened = common_shorten_links($content);
|
$content_shortened = common_shorten_links($content);
|
||||||
|
|
||||||
if (Notice::contentTooLong($content_shortened)) {
|
if (Notice::contentTooLong($content_shortened)) {
|
||||||
|
// @todo FIXME: i18n: Needs plural.
|
||||||
$this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'),
|
$this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'),
|
||||||
Notice::maxContent()));
|
Notice::maxContent()));
|
||||||
return;
|
return;
|
||||||
@ -379,9 +385,7 @@ class FacebookAction extends Action
|
|||||||
$cmd = $inter->handle_command($user, $content_shortened);
|
$cmd = $inter->handle_command($user, $content_shortened);
|
||||||
|
|
||||||
if ($cmd) {
|
if ($cmd) {
|
||||||
|
|
||||||
// XXX fix this
|
// XXX fix this
|
||||||
|
|
||||||
$cmd->execute(new WebChannel());
|
$cmd->execute(new WebChannel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -398,12 +402,10 @@ class FacebookAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FacebookNoticeList extends NoticeList
|
class FacebookNoticeList extends NoticeList
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
@ -423,7 +425,6 @@ class FacebookNoticeList extends NoticeList
|
|||||||
*
|
*
|
||||||
* @return int count of notices listed.
|
* @return int count of notices listed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('div', array('id' =>'notices_primary'));
|
$this->out->elementStart('div', array('id' =>'notices_primary'));
|
||||||
@ -459,17 +460,14 @@ class FacebookNoticeList extends NoticeList
|
|||||||
* @return FacebookNoticeListItem a list item for displaying the notice
|
* @return FacebookNoticeListItem a list item for displaying the notice
|
||||||
* formatted for display in the Facebook App.
|
* formatted for display in the Facebook App.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newListItem($notice)
|
function newListItem($notice)
|
||||||
{
|
{
|
||||||
return new FacebookNoticeListItem($notice, $this);
|
return new FacebookNoticeListItem($notice, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FacebookNoticeListItem extends NoticeListItem
|
class FacebookNoticeListItem extends NoticeListItem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
@ -477,7 +475,6 @@ class FacebookNoticeListItem extends NoticeListItem
|
|||||||
*
|
*
|
||||||
* @param Notice $notice The notice we'll display
|
* @param Notice $notice The notice we'll display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($notice, $out=null)
|
function __construct($notice, $out=null)
|
||||||
{
|
{
|
||||||
parent::__construct($notice, $out);
|
parent::__construct($notice, $out);
|
||||||
@ -491,7 +488,6 @@ class FacebookNoticeListItem extends NoticeListItem
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->showStart();
|
$this->showStart();
|
||||||
@ -502,12 +498,10 @@ class FacebookNoticeListItem extends NoticeListItem
|
|||||||
|
|
||||||
$this->showEnd();
|
$this->showEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
@ -515,7 +509,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
|||||||
*
|
*
|
||||||
* @param Notice $notice The notice we'll display
|
* @param Notice $notice The notice we'll display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($notice, $out=null)
|
function __construct($notice, $out=null)
|
||||||
{
|
{
|
||||||
parent::__construct($notice, $out);
|
parent::__construct($notice, $out);
|
||||||
@ -527,7 +520,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->showNotice();
|
$this->showNotice();
|
||||||
@ -537,7 +529,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
|||||||
|
|
||||||
function showAppLink()
|
function showAppLink()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->facebook = getFacebook();
|
$this->facebook = getFacebook();
|
||||||
|
|
||||||
$app_props = $this->facebook->api_client->Admin_getAppProperties(
|
$app_props = $this->facebook->api_client->Admin_getAppProperties(
|
||||||
@ -551,5 +542,4 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
|
|||||||
$this->out->text($this->app_name);
|
$this->out->text($this->app_name);
|
||||||
$this->out->elementEnd('a');
|
$this->out->elementEnd('a');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FacebookadminpanelAction extends AdminPanelAction
|
class FacebookadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -48,7 +47,6 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _m('Facebook');
|
return _m('Facebook');
|
||||||
@ -59,7 +57,6 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _m('Facebook integration settings');
|
return _m('Facebook integration settings');
|
||||||
@ -70,7 +67,6 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showForm()
|
function showForm()
|
||||||
{
|
{
|
||||||
$form = new FacebookAdminPanelForm($this);
|
$form = new FacebookAdminPanelForm($this);
|
||||||
@ -83,7 +79,6 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
@ -100,7 +95,6 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This throws an exception on validation errors
|
// This throws an exception on validation errors
|
||||||
|
|
||||||
$this->validate($values);
|
$this->validate($values);
|
||||||
|
|
||||||
// assert(all values are valid);
|
// assert(all values are valid);
|
||||||
@ -145,7 +139,6 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'facebookadminpanel';
|
return 'facebookadminpanel';
|
||||||
@ -156,7 +149,6 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
@ -167,7 +159,6 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('facebookadminpanel');
|
return common_local_url('facebookadminpanel');
|
||||||
@ -178,7 +169,6 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
@ -215,9 +205,8 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit', _('Save'), 'submit', null, _('Save Facebook settings'));
|
$this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Facebook settings'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
|
|||||||
|
|
||||||
class FacebookhomeAction extends FacebookAction
|
class FacebookhomeAction extends FacebookAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $page = null;
|
var $page = null;
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
@ -54,7 +53,6 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->flink) {
|
if ($this->flink) {
|
||||||
|
|
||||||
$this->user = $this->flink->getUser();
|
$this->user = $this->flink->getUser();
|
||||||
|
|
||||||
// If this is the first time the user has started the app
|
// If this is the first time the user has started the app
|
||||||
@ -82,18 +80,14 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
// Facebook status update permission? Then show the main page
|
// Facebook status update permission? Then show the main page
|
||||||
// of the app
|
// of the app
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// User hasn't authenticated yet, prompt for creds
|
// User hasn't authenticated yet, prompt for creds
|
||||||
$this->login();
|
$this->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function login()
|
function login()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->showStylesheets();
|
$this->showStylesheets();
|
||||||
|
|
||||||
$nickname = common_canonical_nickname($this->trimmed('nickname'));
|
$nickname = common_canonical_nickname($this->trimmed('nickname'));
|
||||||
@ -102,13 +96,11 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
$msg = null;
|
$msg = null;
|
||||||
|
|
||||||
if ($nickname) {
|
if ($nickname) {
|
||||||
|
|
||||||
if (common_check_user($nickname, $password)) {
|
if (common_check_user($nickname, $password)) {
|
||||||
|
|
||||||
$user = User::staticGet('nickname', $nickname);
|
$user = User::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$this->showLoginForm(_m("Server error - couldn't get user!"));
|
$this->showLoginForm(_m("Server error: Couldn't get user!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$flink = DB_DataObject::factory('foreign_link');
|
$flink = DB_DataObject::factory('foreign_link');
|
||||||
@ -126,7 +118,6 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
|
|
||||||
$this->getUpdatePermission();
|
$this->getUpdatePermission();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$msg = _m('Incorrect username or password.');
|
$msg = _m('Incorrect username or password.');
|
||||||
}
|
}
|
||||||
@ -134,7 +125,6 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
|
|
||||||
$this->showLoginForm($msg);
|
$this->showLoginForm($msg);
|
||||||
$this->showFooter();
|
$this->showFooter();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDefaults()
|
function setDefaults()
|
||||||
@ -155,8 +145,15 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->page > 1) {
|
if ($this->page > 1) {
|
||||||
return sprintf(_m("%s and friends, page %d"), $this->user->nickname, $this->page);
|
// @todo FIXME: Core should have methods to get "Full name (nickname)" in a localised form
|
||||||
|
// so that this can be used consistenly throughout StatusNet without having to implement it
|
||||||
|
// over and over..
|
||||||
|
// TRANS: Page title.
|
||||||
|
// TRANS: %1$s is a user nickname, %2$s is a page number.
|
||||||
|
return sprintf(_m("%1$s and friends, page %2$d"), $this->user->nickname, $this->page);
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Page title.
|
||||||
|
// TRANS: %s is a user nickname
|
||||||
return sprintf(_m("%s and friends"), $this->user->nickname);
|
return sprintf(_m("%s and friends"), $this->user->nickname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,17 +172,16 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
|
|
||||||
function showNoticeList($notice)
|
function showNoticeList($notice)
|
||||||
{
|
{
|
||||||
|
|
||||||
$nl = new NoticeList($notice, $this);
|
$nl = new NoticeList($notice, $this);
|
||||||
return $nl->show();
|
return $nl->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUpdatePermission() {
|
function getUpdatePermission() {
|
||||||
|
|
||||||
$this->showStylesheets();
|
$this->showStylesheets();
|
||||||
|
|
||||||
$this->elementStart('div', array('class' => 'facebook_guide'));
|
$this->elementStart('div', array('class' => 'facebook_guide'));
|
||||||
|
|
||||||
|
// TRANS: Instructions. %s is the application name.
|
||||||
$instructions = sprintf(_m('If you would like the %s app to automatically update ' .
|
$instructions = sprintf(_m('If you would like the %s app to automatically update ' .
|
||||||
'your Facebook status with your latest notice, you need ' .
|
'your Facebook status with your latest notice, you need ' .
|
||||||
'to give it permission.'), $this->app_name);
|
'to give it permission.'), $this->app_name);
|
||||||
@ -209,6 +205,7 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
'&next_cancel=' . $next . '&submit=skip';
|
'&next_cancel=' . $next . '&submit=skip';
|
||||||
|
|
||||||
$this->elementStart('span', array('class' => 'facebook-button'));
|
$this->elementStart('span', array('class' => 'facebook-button'));
|
||||||
|
// @todo FIXME: sprintf not needed here?
|
||||||
$this->element('a', array('href' => $auth_url),
|
$this->element('a', array('href' => $auth_url),
|
||||||
sprintf(_m('Okay, do it!'), $this->app_name));
|
sprintf(_m('Okay, do it!'), $this->app_name));
|
||||||
$this->elementEnd('span');
|
$this->elementEnd('span');
|
||||||
@ -216,13 +213,13 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementStart('li', array('id' => 'fb-permissions-item'));
|
$this->elementStart('li', array('id' => 'fb-permissions-item'));
|
||||||
$this->submit('skip', _m('Skip'));
|
// TRANS: Button text. Clicking the button will skip updating Facebook permissions.
|
||||||
|
$this->submit('skip', _m('BUTTON','Skip'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,7 +235,6 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
*/
|
*/
|
||||||
function pagination($have_before, $have_after, $page, $action, $args=null)
|
function pagination($have_before, $have_after, $page, $action, $args=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Does a little before-after block for next/prev page
|
// Does a little before-after block for next/prev page
|
||||||
|
|
||||||
// XXX: Fix so this uses common_local_url() if possible.
|
// XXX: Fix so this uses common_local_url() if possible.
|
||||||
@ -254,6 +250,7 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
$newargs = $args ? array_merge($args, $pargs) : $pargs;
|
$newargs = $args ? array_merge($args, $pargs) : $pargs;
|
||||||
$this->elementStart('li', array('class' => 'nav_prev'));
|
$this->elementStart('li', array('class' => 'nav_prev'));
|
||||||
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'),
|
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'),
|
||||||
|
// TRANS: Pagination link.
|
||||||
_m('After'));
|
_m('After'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
@ -262,6 +259,7 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
$newargs = $args ? array_merge($args, $pargs) : $pargs;
|
$newargs = $args ? array_merge($args, $pargs) : $pargs;
|
||||||
$this->elementStart('li', array('class' => 'nav_next'));
|
$this->elementStart('li', array('class' => 'nav_next'));
|
||||||
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'),
|
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'),
|
||||||
|
// TRANS: Pagination link.
|
||||||
_m('Before'));
|
_m('Before'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
@ -271,5 +269,4 @@ class FacebookhomeAction extends FacebookAction
|
|||||||
$this->elementEnd('dl');
|
$this->elementEnd('dl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
|
|||||||
|
|
||||||
class FacebookinviteAction extends FacebookAction
|
class FacebookinviteAction extends FacebookAction
|
||||||
{
|
{
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
@ -41,7 +40,6 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showForm($error=null)
|
function showForm($error=null)
|
||||||
{
|
{
|
||||||
$this->error = $error;
|
$this->error = $error;
|
||||||
@ -56,7 +54,6 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if ($this->arg('ids')) {
|
if ($this->arg('ids')) {
|
||||||
@ -68,9 +65,10 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
|
|
||||||
function showSuccessContent()
|
function showSuccessContent()
|
||||||
{
|
{
|
||||||
|
// TRANS: %s is the name of the site.
|
||||||
$this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s'),
|
$this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s.'),
|
||||||
common_config('site', 'name')));
|
common_config('site', 'name')));
|
||||||
|
// TRANS: Followed by an unordered list with invited friends.
|
||||||
$this->element('p', null, _m('Invitations have been sent to the following users:'));
|
$this->element('p', null, _m('Invitations have been sent to the following users:'));
|
||||||
|
|
||||||
$friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list?
|
$friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list?
|
||||||
@ -85,8 +83,7 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd("ul");
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFormContent()
|
function showFormContent()
|
||||||
@ -100,6 +97,7 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
'type' => common_config('site', 'name'),
|
'type' => common_config('site', 'name'),
|
||||||
'content' => $content));
|
'content' => $content));
|
||||||
$this->hidden('invite', 'true');
|
$this->hidden('invite', 'true');
|
||||||
|
// TRANS: %s is the name of the site.
|
||||||
$actiontext = sprintf(_m('Invite your friends to use %s'), common_config('site', 'name'));
|
$actiontext = sprintf(_m('Invite your friends to use %s'), common_config('site', 'name'));
|
||||||
|
|
||||||
$multi_params = array('showborder' => 'false');
|
$multi_params = array('showborder' => 'false');
|
||||||
@ -122,6 +120,7 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
|
|
||||||
if ($exclude_ids) {
|
if ($exclude_ids) {
|
||||||
|
|
||||||
|
// TRANS: %s is the name of the site.
|
||||||
$this->element('h2', null, sprintf(_m('Friends already using %s:'),
|
$this->element('h2', null, sprintf(_m('Friends already using %s:'),
|
||||||
common_config('site', 'name')));
|
common_config('site', 'name')));
|
||||||
$this->elementStart('ul', array('id' => 'facebook-friends'));
|
$this->elementStart('ul', array('id' => 'facebook-friends'));
|
||||||
@ -140,7 +139,7 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Page title.
|
||||||
return sprintf(_m('Send invitations'));
|
return sprintf(_m('Send invitations'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
|
|||||||
|
|
||||||
class FacebookinviteAction extends FacebookAction
|
class FacebookinviteAction extends FacebookAction
|
||||||
{
|
{
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
@ -37,6 +36,7 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
$this->facebook->api_client->data_getUserPreference(
|
$this->facebook->api_client->data_getUserPreference(
|
||||||
FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
|
FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
|
||||||
|
|
||||||
|
// @todo FIXME: Missing i18n?
|
||||||
echo '<h1>REDIRECT TO HOME</h1>';
|
echo '<h1>REDIRECT TO HOME</h1>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -46,7 +46,6 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
|
|
||||||
// If the user has opted not to initially allow the app to have
|
// If the user has opted not to initially allow the app to have
|
||||||
// Facebook status update permission, store that preference. Only
|
// Facebook status update permission, store that preference. Only
|
||||||
// promt the user the first time she uses the app
|
// promt the user the first time she uses the app
|
||||||
@ -56,7 +55,6 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->flink) {
|
if ($this->flink) {
|
||||||
|
|
||||||
$this->user = $this->flink->getUser();
|
$this->user = $this->flink->getUser();
|
||||||
|
|
||||||
// If this is the first time the user has started the app
|
// If this is the first time the user has started the app
|
||||||
@ -69,7 +67,6 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->showLoginForm();
|
$this->showLoginForm();
|
||||||
}
|
}
|
||||||
@ -88,6 +85,8 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// @todo FIXME: Give a more precise description? Suggestion: "Login with Facebook Connect"
|
||||||
|
// TRANS: Page title.
|
||||||
return sprintf(_m('Login'));
|
return sprintf(_m('Login'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,5 +94,4 @@ class FacebookinviteAction extends FacebookAction
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
*
|
*
|
||||||
* Form for posting a notice from within the Facebook App.
|
* Form for posting a notice from within the Facebook App.
|
||||||
*
|
*
|
||||||
* This is a stripped down version of the normal NoticeForm (sans
|
* This is a stripped down version of the normal NoticeForm (sans
|
||||||
* location stuff and media upload stuff). I'm not sure we can share the
|
* location stuff and media upload stuff). I'm not sure we can share the
|
||||||
@ -53,31 +53,26 @@ require_once INSTALLDIR . '/lib/form.php';
|
|||||||
*
|
*
|
||||||
* @see HTMLOutputter
|
* @see HTMLOutputter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FacebookNoticeForm extends Form
|
class FacebookNoticeForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Current action, used for returning to this page.
|
* Current action, used for returning to this page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-filled content of the form
|
* Pre-filled content of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $content = null;
|
var $content = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current user
|
* The current user
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $user = null;
|
var $user = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The notice being replied to
|
* The notice being replied to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $inreplyto = null;
|
var $inreplyto = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +82,6 @@ class FacebookNoticeForm extends Form
|
|||||||
* @param string $action action to return to, if any
|
* @param string $action action to return to, if any
|
||||||
* @param string $content content to pre-fill
|
* @param string $content content to pre-fill
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out=null, $action=null, $content=null, $post_action=null, $user=null, $inreplyto=null)
|
function __construct($out=null, $action=null, $content=null, $post_action=null, $user=null, $inreplyto=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
@ -102,7 +96,7 @@ class FacebookNoticeForm extends Form
|
|||||||
} else {
|
} else {
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: Facebook doesn't allow multipart/form-data posting to
|
// Note: Facebook doesn't allow multipart/form-data posting to
|
||||||
// canvas pages, so don't try to set it--no file uploads, at
|
// canvas pages, so don't try to set it--no file uploads, at
|
||||||
// least not this way. It can be done using multiple servers
|
// least not this way. It can be done using multiple servers
|
||||||
@ -114,7 +108,6 @@ class FacebookNoticeForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string ID of the form
|
* @return string ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_notice';
|
return 'form_notice';
|
||||||
@ -125,7 +118,6 @@ class FacebookNoticeForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_notice';
|
return 'form_notice';
|
||||||
@ -136,7 +128,6 @@ class FacebookNoticeForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return $this->post_action;
|
return $this->post_action;
|
||||||
@ -149,7 +140,8 @@ class FacebookNoticeForm extends Form
|
|||||||
*/
|
*/
|
||||||
function formLegend()
|
function formLegend()
|
||||||
{
|
{
|
||||||
$this->out->element('legend', null, _('Send a notice'));
|
// TRANS: Legend.
|
||||||
|
$this->out->element('legend', null, _m('Send a notice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,12 +149,12 @@ class FacebookNoticeForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
if (Event::handle('StartShowNoticeFormData', array($this))) {
|
if (Event::handle('StartShowNoticeFormData', array($this))) {
|
||||||
$this->out->element('label', array('for' => 'notice_data-text'),
|
$this->out->element('label', array('for' => 'notice_data-text'),
|
||||||
sprintf(_('What\'s up, %s?'), $this->user->nickname));
|
// TRANS: Field label.
|
||||||
|
sprintf(_m('What\'s up, %s?'), $this->user->nickname));
|
||||||
// XXX: vary by defined max size
|
// XXX: vary by defined max size
|
||||||
$this->out->element('textarea', array('id' => 'notice_data-text',
|
$this->out->element('textarea', array('id' => 'notice_data-text',
|
||||||
'cols' => 35,
|
'cols' => 35,
|
||||||
@ -174,7 +166,7 @@ class FacebookNoticeForm extends Form
|
|||||||
|
|
||||||
if ($contentLimit > 0) {
|
if ($contentLimit > 0) {
|
||||||
$this->out->elementStart('dl', 'form_note');
|
$this->out->elementStart('dl', 'form_note');
|
||||||
$this->out->element('dt', null, _('Available characters'));
|
$this->out->element('dt', null, _m('Available characters'));
|
||||||
$this->out->element('dd', array('id' => 'notice_text-count'),
|
$this->out->element('dd', array('id' => 'notice_text-count'),
|
||||||
$contentLimit);
|
$contentLimit);
|
||||||
$this->out->elementEnd('dl');
|
$this->out->elementEnd('dl');
|
||||||
@ -194,13 +186,13 @@ class FacebookNoticeForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->element('input', array('id' => 'notice_action-submit',
|
$this->out->element('input', array('id' => 'notice_action-submit',
|
||||||
'class' => 'submit',
|
'class' => 'submit',
|
||||||
'name' => 'status_submit',
|
'name' => 'status_submit',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => _('Send')));
|
// TRANS: Button text.
|
||||||
|
'value' => _m('BUTTON','Send')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
|
|||||||
|
|
||||||
class FacebookremoveAction extends FacebookAction
|
class FacebookremoveAction extends FacebookAction
|
||||||
{
|
{
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
@ -65,5 +64,4 @@ class FacebookremoveAction extends FacebookAction
|
|||||||
'unsuccessfully tried to remove a foreign link to Facebook!');
|
'unsuccessfully tried to remove a foreign link to Facebook!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
|
|||||||
|
|
||||||
class FacebooksettingsAction extends FacebookAction
|
class FacebooksettingsAction extends FacebookAction
|
||||||
{
|
{
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
@ -40,7 +39,6 @@ class FacebooksettingsAction extends FacebookAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if ($this->arg('save')) {
|
if ($this->arg('save')) {
|
||||||
@ -62,6 +60,7 @@ class FacebooksettingsAction extends FacebookAction
|
|||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$this->showForm(_m('There was a problem saving your sync preferences!'));
|
$this->showForm(_m('There was a problem saving your sync preferences!'));
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Confirmation that synchronisation settings have been saved into the system.
|
||||||
$this->showForm(_m('Sync preferences saved.'), true);
|
$this->showForm(_m('Sync preferences saved.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,16 +98,16 @@ class FacebooksettingsAction extends FacebookAction
|
|||||||
|
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
|
|
||||||
$this->submit('save', _m('Save'));
|
// TRANS: Submit button to save synchronisation settings.
|
||||||
|
$this->submit('save', _m('BUTTON','Save'));
|
||||||
|
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: %s is the application name.
|
||||||
$instructions = sprintf(_m('If you would like %s to automatically update ' .
|
$instructions = sprintf(_m('If you would like %s to automatically update ' .
|
||||||
'your Facebook status with your latest notice, you need ' .
|
'your Facebook status with your latest notice, you need ' .
|
||||||
'to give it permission.'), $this->app_name);
|
'to give it permission.'), $this->app_name);
|
||||||
@ -127,12 +126,11 @@ class FacebooksettingsAction extends FacebookAction
|
|||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Page title for synchronisation settings.
|
||||||
return _m('Sync preferences');
|
return _m('Sync preferences');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,11 @@ function getFacebook()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isFacebookBound($notice, $flink) {
|
function isFacebookBound($notice, $flink) {
|
||||||
|
|
||||||
if (empty($flink)) {
|
if (empty($flink)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid a loop
|
// Avoid a loop
|
||||||
|
|
||||||
if ($notice->source == 'Facebook') {
|
if ($notice->source == 'Facebook') {
|
||||||
common_log(LOG_INFO, "Skipping notice $notice->id because its " .
|
common_log(LOG_INFO, "Skipping notice $notice->id because its " .
|
||||||
'source is Facebook.');
|
'source is Facebook.');
|
||||||
@ -59,7 +57,6 @@ function isFacebookBound($notice, $flink) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the user does not want to broadcast to Facebook, move along
|
// If the user does not want to broadcast to Facebook, move along
|
||||||
|
|
||||||
if (!($flink->noticesync & FOREIGN_NOTICE_SEND == FOREIGN_NOTICE_SEND)) {
|
if (!($flink->noticesync & FOREIGN_NOTICE_SEND == FOREIGN_NOTICE_SEND)) {
|
||||||
common_log(LOG_INFO, "Skipping notice $notice->id " .
|
common_log(LOG_INFO, "Skipping notice $notice->id " .
|
||||||
'because user has FOREIGN_NOTICE_SEND bit off.');
|
'because user has FOREIGN_NOTICE_SEND bit off.');
|
||||||
@ -68,14 +65,12 @@ function isFacebookBound($notice, $flink) {
|
|||||||
|
|
||||||
// If it's not a reply, or if the user WANTS to send @-replies,
|
// If it's not a reply, or if the user WANTS to send @-replies,
|
||||||
// then, yeah, it can go to Facebook.
|
// then, yeah, it can go to Facebook.
|
||||||
|
|
||||||
if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
|
if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
|
||||||
($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY)) {
|
($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function facebookBroadcastNotice($notice)
|
function facebookBroadcastNotice($notice)
|
||||||
@ -87,16 +82,12 @@ function facebookBroadcastNotice($notice)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (isFacebookBound($notice, $flink)) {
|
if (isFacebookBound($notice, $flink)) {
|
||||||
|
|
||||||
// Okay, we're good to go, update the FB status
|
// Okay, we're good to go, update the FB status
|
||||||
|
|
||||||
$fbuid = $flink->foreign_id;
|
$fbuid = $flink->foreign_id;
|
||||||
$user = $flink->getUser();
|
$user = $flink->getUser();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Check permissions
|
// Check permissions
|
||||||
|
|
||||||
common_debug(
|
common_debug(
|
||||||
'FacebookPlugin - checking for publish_stream permission for user '
|
'FacebookPlugin - checking for publish_stream permission for user '
|
||||||
. "$user->nickname ($user->id), Facebook UID: $fbuid"
|
. "$user->nickname ($user->id), Facebook UID: $fbuid"
|
||||||
@ -105,7 +96,6 @@ function facebookBroadcastNotice($notice)
|
|||||||
// NOTE: $facebook->api_client->users_hasAppPermission('publish_stream', $fbuid)
|
// NOTE: $facebook->api_client->users_hasAppPermission('publish_stream', $fbuid)
|
||||||
// has been returning bogus results, so we're using FQL to check for
|
// has been returning bogus results, so we're using FQL to check for
|
||||||
// publish_stream permission now
|
// publish_stream permission now
|
||||||
|
|
||||||
$fql = "SELECT publish_stream FROM permissions WHERE uid = $fbuid";
|
$fql = "SELECT publish_stream FROM permissions WHERE uid = $fbuid";
|
||||||
$result = $facebook->api_client->fql_query($fql);
|
$result = $facebook->api_client->fql_query($fql);
|
||||||
|
|
||||||
@ -152,7 +142,6 @@ function facebookBroadcastNotice($notice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Post to Facebook
|
// Post to Facebook
|
||||||
|
|
||||||
if ($notice->hasAttachments() && $canPublish == 1) {
|
if ($notice->hasAttachments() && $canPublish == 1) {
|
||||||
publishStream($notice, $user, $fbuid);
|
publishStream($notice, $user, $fbuid);
|
||||||
} elseif ($canUpdate == 1 || $canPublish == 1) {
|
} elseif ($canUpdate == 1 || $canPublish == 1) {
|
||||||
@ -165,7 +154,6 @@ function facebookBroadcastNotice($notice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, attempt to update the user's profile box
|
// Finally, attempt to update the user's profile box
|
||||||
|
|
||||||
if ($canPublish == 1 || $canUpdate == 1) {
|
if ($canPublish == 1 || $canUpdate == 1) {
|
||||||
updateProfileBox($facebook, $flink, $notice, $user);
|
updateProfileBox($facebook, $flink, $notice, $user);
|
||||||
}
|
}
|
||||||
@ -412,7 +400,6 @@ function remove_facebook_app($flink)
|
|||||||
|
|
||||||
common_log(LOG_WARNING, $msg);
|
common_log(LOG_WARNING, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -423,7 +410,6 @@ function remove_facebook_app($flink)
|
|||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function mail_facebook_app_removed($user)
|
function mail_facebook_app_removed($user)
|
||||||
{
|
{
|
||||||
$profile = $user->getProfile();
|
$profile = $user->getProfile();
|
||||||
@ -447,5 +433,4 @@ function mail_facebook_app_removed($user)
|
|||||||
|
|
||||||
common_switch_locale();
|
common_switch_locale();
|
||||||
return mail_to_user($user, $subject, $body);
|
return mail_to_user($user, $subject, $body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user