X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffacebookaction.php;h=3f3a8d3b094b44cde2f94385d60247e49257eef1;hb=4f5badda94071d9debc8dacfbc9072be3c2ee73d;hp=1ae90d53bdeb534afd8a65a1f5f51c5b90a2b480;hpb=97373d845cd68d6145f3751c9f602b13f04b37df;p=quix0rs-gnu-social.git diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 1ae90d53bd..3f3a8d3b09 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -1,6 +1,6 @@ . * * @category Faceboook - * @package Laconica - * @author Zach Copley - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,7 +35,6 @@ if (!defined('LACONICA')) require_once INSTALLDIR.'/lib/facebookutil.php'; require_once INSTALLDIR.'/lib/noticeform.php'; - class FacebookAction extends Action { @@ -95,34 +94,14 @@ class FacebookAction extends Action function showStylesheets() { - // Add a timestamp to the file so Facebook cache wont ignore our changes - $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css'); - - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts)); - - $theme = common_config('site', 'theme'); - - $ts = filemtime(INSTALLDIR. '/theme/' . $theme .'/css/display.css'); - - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => theme_path('css/display.css', null) . '?ts=' . $ts)); - - $ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.css'); - - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => theme_path('css/facebookapp.css', 'base') . '?ts=' . $ts)); + $this->cssLink('css/display.css', 'base'); + $this->cssLink('css/display.css',null,'screen, projection, tv'); + $this->cssLink('css/facebookapp.css', 'base'); } function showScripts() { - // Add a timestamp to the file so Facebook cache wont ignore our changes - $ts = filemtime(INSTALLDIR.'/js/facebookapp.js'); - - $this->element('script', array('src' => common_path('js/facebookapp.js') . '?ts=' . $ts)); + $this->script('js/facebookapp.js'); } /** @@ -201,7 +180,6 @@ class FacebookAction extends Action } - // Make this into a widget later function showLocalNav() { @@ -261,7 +239,6 @@ class FacebookAction extends Action $this->endHTML(); } - function showInstructions() { @@ -287,7 +264,6 @@ class FacebookAction extends Action $this->elementEnd('div'); } - function showLoginForm($msg = null) { @@ -332,7 +308,6 @@ class FacebookAction extends Action } - function updateProfileBox($notice) { @@ -389,7 +364,7 @@ class FacebookAction extends Action display:inline-block; } - #facebook_laconica_app { + #facebook_statusnet_app { text-indent:-9999px; height:16px; width:16px; @@ -414,7 +389,6 @@ class FacebookAction extends Action $this->xw->openURI('php://output'); } - /** * Generate pagination links * @@ -460,16 +434,6 @@ class FacebookAction extends Action } } - function updateFacebookStatus($notice) - { - $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, $this->fbuid); - $content = "$prefix $notice->content"; - - if ($this->facebook->api_client->users_hasAppPermission('status_update', $this->fbuid)) { - $this->facebook->api_client->users_setStatus($content, $this->fbuid, false, true); - } - } - function saveNewNotice() { @@ -483,8 +447,9 @@ class FacebookAction extends Action } else { $content_shortened = common_shorten_links($content); - if (mb_strlen($content_shortened) > 140) { - $this->showPage(_('That\'s too long. Max notice size is 140 chars.')); + if (Notice::contentTooLong($content_shortened)) { + $this->showPage(sprintf(_('That\'s too long. Max notice size is %d chars.'), + Notice::maxContent())); return; } } @@ -503,19 +468,18 @@ class FacebookAction extends Action $replyto = $this->trimmed('inreplyto'); - $notice = Notice::saveNew($user->id, $content, - 'Facebook', 1, ($replyto == 'false') ? null : $replyto); - - if (is_string($notice)) { - $this->showPage($notice); + try { + $notice = Notice::saveNew($user->id, $content, + 'web', 1, ($replyto == 'false') ? null : $replyto); + } catch (Exception $e) { + $this->showPage($e->getMessage()); return; } common_broadcast_notice($notice); // Also update the user's Facebook status - $this->updateFacebookStatus($notice); - $this->updateProfileBox($notice); + facebookBroadcastNotice($notice); } @@ -699,7 +663,7 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name']; $this->app_name = $app_props['application_name']; - $this->out->elementStart('a', array('id' => 'facebook_laconica_app', + $this->out->elementStart('a', array('id' => 'facebook_statusnet_app', 'href' => $this->app_uri)); $this->out->text($this->app_name); $this->out->elementEnd('a');