From dccf8374cf7e4673cbc83f695e1665031bdf6539 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 5 Dec 2008 22:01:32 -0500 Subject: trac750 - Exoskeleton of a nascent Facebook app darcs-hash:20081206030132-7b5ce-96c38ab67edd3d58f8722ef25852a6143f05a86b.gz --- lib/facebookaction.php | 185 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 lib/facebookaction.php (limited to 'lib') diff --git a/lib/facebookaction.php b/lib/facebookaction.php new file mode 100644 index 000000000..5505a12c3 --- /dev/null +++ b/lib/facebookaction.php @@ -0,0 +1,185 @@ +. + */ + +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); + } + + + # Display methods + + function show_header($selected ='Home') { + + # $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.' + .'

' + .'
' + .'
' + .'
' + .'

' + .' ' + .' ' + .'

' + .'

' + .' ' + .' ' + .'

' + .'

' + .' ' + .'

' + .'
' + .'

' + .' 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 = + '
  • ' + .'' + .'';
+
+		if ($profile->fullname) {
+			$html .= $profile->fullname;
+		} else {
+			$html .= $profile->nickname;
+		}
+
+		$html .=
+		'' + .'' . $profile->nickname . '' + .'

    ' . $notice->rendered . '

    ' + .'

    ' + .''; + + 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; + } + + +} -- cgit v1.2.3-54-g00ecf