X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffacebookaction.php;h=3a00c71dd0108e72faf569edb23c98978d111786;hb=f294eab92a4e44c0ad8790b7875173a1340f4b5c;hp=ee9f783c400c746a18b627b73698bf5d4359ace3;hpb=fd6f9b9d7622f280f92810770deb217eb7301c14;p=quix0rs-gnu-social.git
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index ee9f783c40..3a00c71dd0 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -21,7 +21,6 @@ if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/facebookutil.php');
-
class FacebookAction extends Action
{
@@ -30,259 +29,96 @@ class FacebookAction extends Action
parent::handle($args);
}
- function update_profile_box($facebook, $fbuid, $user)
+ function show_header($selected = 'Home', $msg = null, $success = false)
{
- $notice = $user->getCurrentNotice();
-
- # Need to include inline CSS for styling the Profile box
-
- $style = '';
-
- $html = $this->render_notice($notice);
-
- $fbml = "$content $html";
- $fbml .= "$content $html";
-
- $fbml_main = "$content $html";
-
- $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
- }
-
- # Display methods
-
- function show_header($selected ='Home')
- {
+ start_fbml();
# 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";
- $header = '';
- # $header .='';
- $header .= '';
-
- $header .=
- ''
- .''
- .''
- .''
- .'';
- $header .= '
';
+ common_element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => $cssurl));
- echo $header;
+ common_element('fb:dashboard');
- }
+ common_element_start('fb:tabs');
+ common_element('fb:tab-item', array('title' => 'Home',
+ 'href' => 'index.php',
+ 'selected' => ($selected == 'Home')));
+ common_element('fb:tab-item', array('title' => 'Invite',
+ 'href' => 'invite.php',
+ 'selected' => ($selected == 'Invite')));
+ common_element('fb:tab-item', array('title' => 'Settings',
+ 'href' => 'settings.php',
+ 'selected' => ($selected == 'Settings')));
+ common_element_end('fb:tabs');
- function show_footer()
- {
- $footer = '
';
- echo $footer;
- }
- function show_login_form()
- {
+ if ($msg) {
+ if ($success) {
+ common_element('fb:success', array('message' => $msg));
+ } else {
+ // XXX do an error message here
+ }
+ }
- $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?'
- .'
'
- .'
getProfile();
- $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-
- $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-
- # 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;
- }
-
- $html =
- ''
- .''
- .'
'
- .'' . $profile->nickname . ''
- .'' . $notice->rendered . '
'
- .''
- .'' . common_date_string($notice->created) . '';
-
- if ($notice->source) {
- $html .= _(' from ');
- $html .= $this->source_link($notice->source);
- }
-
- if ($notice->reply_to) {
- $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
- $html .=
- ' (' . _('in reply to...') . ')';
- }
-
- $html .= '
';
-
- return $html;
+ common_element_end('div');
+ common_end_xml();
}
- function source_link($source)
+ function showLoginForm($msg = null)
{
- $source_name = _($source);
+ start_fbml();
- $html = '';
+ common_element_start('a', array('href' => 'http://identi.ca'));
+ common_element('img', array('src' => 'http://theme.identi.ca/identica/logo.png',
+ 'alt' => 'Identi.ca',
+ 'id' => 'logo'));
+ common_element_end('a');
- 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) {
+ common_element('fb:error', array('message' => $msg));
}
- $html .= '';
+ common_element("h2", null,
+ _('To add the Identi.ca application, you need to log into your Identi.ca account.'));
- return $html;
- }
- function pagination($have_before, $have_after, $page, $fbaction, $args=null)
- {
+ common_element_start('div', array('class' => 'instructions'));
+ common_element_start('p');
+ common_raw('Login with your username and password. Don\'t have a username yet?'
+ .' Register a new account.');
+ common_element_end('p');
+ common_element_end('div');
- $html = '';
+ common_element_start('div', array('id' => 'content'));
+ common_element_start('form', array('method' => 'post',
+ 'id' => 'login',
+ 'action' => 'index.php'));
+ common_input('nickname', _('Nickname'));
+ common_password('password', _('Password'));
- if ($have_before || $have_after) {
- $html = '