.
*/
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
class FacebookAction extends Action {
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 update_profile_box($facebook, $fbuid, $user) {
$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') {
# 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 .= '
';
echo $header;
}
function show_footer() {
$footer = '
';
echo $footer;
}
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.'
.'
'
.'
'
.'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;
}
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;
}
$html .= ' ';
return $html;
}
function pagination($have_before, $have_after, $page, $fbaction, $args=null) {
$html = '';
if ($have_before || $have_after) {
$html = '