X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FFacebook%2Ffacebookaction.php;h=8437a705a7b7858ce5f4ecc416843ddd15182da2;hb=97b01432e7903797e39205e46a51394feac54292;hp=2327694e43edc5c9eacbcb384b38b134eea3d670;hpb=691beefd0f3755bab195279b1c0d7cc583942b72;p=quix0rs-gnu-social.git diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php index 2327694e43..8437a705a7 100644 --- a/plugins/Facebook/facebookaction.php +++ b/plugins/Facebook/facebookaction.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php'; -require_once INSTALLDIR . '/lib/noticeform.php'; +require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php'; class FacebookAction extends Action { @@ -44,7 +44,7 @@ class FacebookAction extends Action var $app_uri = null; var $app_name = null; - function __construct($output='php://output', $indent=true, $facebook=null, $flink=null) + function __construct($output='php://output', $indent=null, $facebook=null, $flink=null) { parent::__construct($output, $indent); @@ -89,13 +89,13 @@ class FacebookAction extends Action function showScripts() { - $this->script('js/facebookapp.js'); + $this->script(common_path('plugins/Facebook/facebookapp.js')); } /** * Start an Facebook ready HTML document * - * For Facebook we do not want to actually output any headers, + * For Facebook we don't want to actually output any headers, * DTD info, etc. Just Stylesheet and JavaScript links. * * @param string $type MIME type to use; default is to do negotation. @@ -129,7 +129,7 @@ class FacebookAction extends Action */ function showNoticeForm() { - // do not do it for most of the Facebook pages + // don't do it for most of the Facebook pages } function showBody() @@ -168,7 +168,7 @@ class FacebookAction extends Action $this->elementStart('li', array('class' => ($this->action == 'facebookhome') ? 'current' : 'facebook_home')); $this->element('a', - array('href' => 'index.php', 'title' => _('Home')), _('Home')); + array('href' => 'index.php', 'title' => _m('Home')), _m('Home')); $this->elementEnd('li'); if (common_config('invite', 'enabled')) { @@ -176,7 +176,7 @@ class FacebookAction extends Action array('class' => ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); $this->element('a', - array('href' => 'invite.php', 'title' => _('Invite')), _('Invite')); + array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite')); $this->elementEnd('li'); } @@ -185,7 +185,7 @@ class FacebookAction extends Action ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings')); $this->element('a', array('href' => 'settings.php', - 'title' => _('Settings')), _('Settings')); + 'title' => _m('Settings')), _m('Settings')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -225,15 +225,15 @@ class FacebookAction extends Action $this->elementStart('dl', array('class' => 'system_notice')); $this->element('dt', null, 'Page Notice'); - $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . + $loginmsg_part1 = _m('To use the %s Facebook Application you need to login ' . 'with your username and password. Don\'t have a username yet? '); - $loginmsg_part2 = _(' a new account.'); + $loginmsg_part2 = _m(' a new account.'); $this->elementStart('dd'); $this->elementStart('p'); $this->text(sprintf($loginmsg_part1, common_config('site', 'name'))); $this->element('a', - array('href' => common_local_url('register')), _('Register')); + array('href' => common_local_url('register')), _m('Register')); $this->text($loginmsg_part2); $this->elementEnd('p'); $this->elementEnd('dd'); @@ -246,7 +246,7 @@ class FacebookAction extends Action { $this->elementStart('div', array('id' => 'content')); - $this->element('h1', null, _('Login')); + $this->element('h1', null, _m('Login')); if ($msg) { $this->element('fb:error', array('message' => $msg)); @@ -265,20 +265,20 @@ class FacebookAction extends Action $this->elementStart('ul', array('class' => 'form_datas')); $this->elementStart('li'); - $this->input('nickname', _('Nickname')); + $this->input('nickname', _m('Nickname')); $this->elementEnd('li'); $this->elementStart('li'); - $this->password('password', _('Password')); + $this->password('password', _m('Password')); $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('submit', _('Login')); + $this->submit('submit', _m('Login')); $this->elementEnd('fieldset'); $this->elementEnd('form'); $this->elementStart('p'); $this->element('a', array('href' => common_local_url('recoverpassword')), - _('Lost or forgotten password?')); + _m('Lost or forgotten password?')); $this->elementEnd('p'); $this->elementEnd('div'); @@ -294,63 +294,7 @@ class FacebookAction extends Action $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url')); $icon_url = $app_props['icon_url']; - $style = ''; + $style = ''; $this->xw->openMemory(); @@ -382,9 +326,8 @@ class FacebookAction extends Action { // Does a little before-after block for next/prev page if ($have_before || $have_after) { - $this->elementStart('div', array('class' => 'pagination')); - $this->elementStart('dl', null); - $this->element('dt', null, _('Pagination')); + $this->elementStart('dl', 'pagination'); + $this->element('dt', null, _m('Pagination')); $this->elementStart('dd', null); $this->elementStart('ul', array('class' => 'nav')); } @@ -393,7 +336,7 @@ class FacebookAction extends Action $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_prev')); $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'prev'), - _('After')); + _m('After')); $this->elementEnd('li'); } if ($have_after) { @@ -401,14 +344,13 @@ class FacebookAction extends Action $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_next')); $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'next'), - _('Before')); + _m('Before')); $this->elementEnd('li'); } if ($have_before || $have_after) { $this->elementEnd('ul'); $this->elementEnd('dd'); $this->elementEnd('dl'); - $this->elementEnd('div'); } } @@ -420,13 +362,13 @@ class FacebookAction extends Action $content = $this->trimmed('status_textarea'); if (!$content) { - $this->showPage(_('No notice content!')); + $this->showPage(_m('No notice content!')); return; } else { $content_shortened = common_shorten_links($content); if (Notice::contentTooLong($content_shortened)) { - $this->showPage(sprintf(_('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())); return; } @@ -447,51 +389,14 @@ class FacebookAction extends Action $replyto = $this->trimmed('inreplyto'); try { - $notice = Notice::saveNew($user->id, $content, - 'web', 1, ($replyto == 'false') ? null : $replyto); + $notice = Notice::saveNew($user->id, $content, 'web', + array('reply_to' => ($replyto == 'false') ? null : $replyto)); + } catch (Exception $e) { $this->showPage($e->getMessage()); return; } - common_broadcast_notice($notice); - - // Also update the user's Facebook status - facebookBroadcastNotice($notice); - - } - -} - -class FacebookNoticeForm extends NoticeForm -{ - - var $post_action = null; - - /** - * Constructor - * - * @param HTMLOutputter $out output channel - * @param string $action action to return to, if any - * @param string $content content to pre-fill - */ - - function __construct($out=null, $action=null, $content=null, - $post_action=null, $user=null) - { - parent::__construct($out, $action, $content, $user); - $this->post_action = $post_action; - } - - /** - * Action of the form - * - * @return string URL of the action - */ - - function action() - { - return $this->post_action; } } @@ -522,7 +427,7 @@ class FacebookNoticeList extends NoticeList function show() { $this->out->elementStart('div', array('id' =>'notices_primary')); - $this->out->element('h2', null, _('Notices')); + $this->out->element('h2', null, _m('Notices')); $this->out->elementStart('ul', array('class' => 'notices')); $cnt = 0; @@ -581,7 +486,7 @@ class FacebookNoticeListItem extends NoticeListItem /** * recipe function for displaying a single notice in the Facebook App. * - * Overridden to strip out some of the controls that we do not + * Overridden to strip out some of the controls that we don't * want to be available. * * @return void