X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffacebookaction.php;h=6d42596e8e9a383d1eeb722e0d157481d775f27b;hb=690273e20d98f33e43a490dc129a4d05dd06274c;hp=731460f12c91178f09c5432cbbda4a0b1596f5bb;hpb=eb2f9c98ac115ce67e9a740b200c832153ffa05c;p=quix0rs-gnu-social.git
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 731460f12c..6d42596e8e 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -17,267 +17,250 @@
* along with this program. If not, see .
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
+require_once INSTALLDIR.'/lib/facebookutil.php';
-class FacebookAction extends Action {
+class FacebookAction extends Action
+{
- function handle($args) {
+ function handle($args)
+ {
parent::handle($args);
}
- function get_facebook() {
- $apikey = common_config('facebook', 'apikey');
- $secret = common_config('facebook', 'secret');
- return new Facebook($apikey, $secret);
+ function showLogo(){
+
+ global $xw;
+
+ $this->showStylesheets();
+ $this->showScripts();
+
+ $this->elementStart('a', array('class' => 'url home bookmark',
+ 'href' => common_local_url('public')));
+ if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
+ $this->element('img', array('class' => 'logo photo',
+ 'src' => (common_config('site', 'logo')) ?
+ common_config('site', 'logo') : theme_path('logo.png'),
+ 'alt' => common_config('site', 'name')));
+ }
+
+ $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
+ $this->elementEnd('a');
+
}
- function update_profile_box($facebook, $fbuid, $user) {
+ function showHeader($msg = null, $success = false)
+ {
+ startFBML();
- $notice = $user->getCurrentNotice();
+ $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
+ $this->elementStart('span', array('id' => 'add_to_profile'));
+ $this->element('fb:add-section-button', array('section' => 'profile'));
+ $this->elementEnd('span');
+ $this->elementEnd('fb:if-section-not-added');
- # Need to include inline CSS for styling the Profile box
+ $this->showLogo();
- $style = '';
- $html = $this->render_notice($notice);
+ $this->elementStart('div', 'main_body');
- $fbml = "$content $html";
- $fbml .= "$content $html";
+ }
- $fbml_main = "$content $html";
+ function showNav($selected = 'Home')
+ {
- $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
- }
+ $this->elementStart('dl', array("id" => 'site_nav_local_views'));
+ $this->element('dt', null, _('Local Views'));
+ $this->elementStart('dd');
- # Display methods
+ $this->elementStart('ul', array('class' => 'nav'));
- function show_header($selected ='Home') {
+ $this->elementStart('li', array('class' =>
+ ($selected == 'Home') ? 'current' : 'facebook_home'));
+ $this->element('a',
+ array('href' => 'index.php', 'title' => _('Home')), _('Home'));
+ $this->elementEnd('li');
- # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
- $ts = filemtime(theme_file('facebookapp.css'));
- $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
+ $this->elementStart('li',
+ array('class' =>
+ ($selected == 'Invite') ? 'current' : 'facebook_invite'));
+ $this->element('a',
+ array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
+ $this->elementEnd('li');
- $header = '';
- # $header .='';
- $header .= '';
+ $this->elementStart('li',
+ array('class' =>
+ ($selected == 'Settings') ? 'current' : 'facebook_settings'));
+ $this->element('a',
+ array('href' => 'settings.php',
+ 'title' => _('Settings')), _('Settings'));
+ $this->elementEnd('li');
- $header .=
- ''
- .''
- .''
- .''
- .'';
- $header .= '
';
+ $this->elementEnd('ul');
- echo $header;
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
}
- function show_footer() {
- $footer = '
';
- echo $footer;
+ function showFooter()
+ {
+ $this->elementEnd('div');
+ $this->endXml();
}
- function show_login_form() {
-
- $loginform =
- ' To add the Identi.ca application, you need to log into your Identi.ca account.
'
- .''
- .' '
- .''
- .'Login
'
- .''
- .'
Login with your username and password. Don\'t have a username yet?'
- .' Register a new account.'
- .'
'
- .'
'
- .''
- .'
'
- .'
'
- .' Lost or forgotten password?'
- .'
'
- .'
elementStart('dl', array('class' => 'system_notice'));
+ $this->element('dt', null, 'Page Notice');
- global $config;
+ $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
+ 'with your username and password. Don\'t have a username yet? ');
- $profile = $notice->getProfile();
- $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
+ $loginmsg_part2 = _(' a new account.');
- $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
+ $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'));
+ $this->text($loginmsg_part2);
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+ }
- # XXX: we need to figure this out better. Is this right?
- if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
- $noticeurl = $notice->uri;
- }
+ function showStylesheets()
+ {
+ global $xw;
- $html =
- ''
- .''
- .''
- .'' . $profile->nickname . ''
- .'' . $notice->rendered . '
'
- .''
- .'' . common_date_string($notice->created) . '';
+ }
- if ($notice->source) {
- $html .= _(' from ');
- $html .= $this->source_link($notice->source);
- }
+ function showLoginForm($msg = null)
+ {
+ startFBML();
- if ($notice->reply_to) {
- $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
- $html .=
- ' (' . _('in reply to...') . ')';
- }
+ $this->showStylesheets();
+ $this->showScripts();
- $html .= '
';
+ $this->showLogo();
- return $html;
- }
+ $this->elementStart('div', array('class' => 'content'));
+ $this->element('h1', null, _('Login'));
- function source_link($source) {
- $source_name = _($source);
-
- $html = '';
-
- switch ($source) {
- case 'web':
- case 'xmpp':
- case 'mail':
- case 'omb':
- case 'api':
- $html .= $source_name;
- break;
- default:
- $ns = Notice_source::staticGet($source);
- if ($ns) {
- $html .= '' . $ns->name . '';
- } else {
- $html .= $source_name;
- }
- break;
+ if ($msg) {
+ $this->element('fb:error', array('message' => $msg));
}
- $html .= '';
-
- return $html;
- }
+ $this->showInstructions();
- function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
+ $this->elementStart('div', array('id' => 'content_inner'));
- $html = '';
+ $this->elementStart('form', array('method' => 'post',
+ 'class' => 'form_settings',
+ 'id' => 'login',
+ 'action' => 'index.php'));
- if ($have_before || $have_after) {
- $html = '