X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ffacebookaction.php;h=6d42596e8e9a383d1eeb722e0d157481d775f27b;hb=a6fd4eb0a3b22b21940e00251b8964e231036b40;hp=9230bad59368c025d09ab1f0f99579dfca11819c;hpb=4bb522c3faa23a738c1a47440759aff741925d78;p=quix0rs-gnu-social.git diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 9230bad593..6d42596e8e 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1); } - -require_once(INSTALLDIR.'/lib/facebookutil.php'); +if (!defined('LACONICA')) { + exit(1); +} +require_once INSTALLDIR.'/lib/facebookutil.php'; class FacebookAction extends Action { @@ -30,260 +31,236 @@ class FacebookAction extends Action parent::handle($args); } - function update_profile_box($facebook, $fbuid, $user) - { + function showLogo(){ - $notice = $user->getCurrentNotice(); - - # Need to include inline CSS for styling the Profile box - - $style = ''; - - $html = Facebookaction::render_notice($notice); - - - $fbml = "$style $html"; - $fbml .= "$style $html"; - - $fbml_main = "$style $html"; - - $facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main); - } + 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'); - # Display methods + } - function show_header($selected ='Home') + function showHeader($msg = null, $success = false) { + startFBML(); - # 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('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'); - $header = ''; - # $header .=''; - $header .= ''; + $this->showLogo(); - $header .= - '' - .'' - .'' - .'' - .''; - $header .= '
'; + if ($msg) { + if ($success) { + $this->element('fb:success', array('message' => $msg)); + } else { + // XXX do an error message here + } + } - echo $header; + $this->elementStart('div', 'main_body'); } - function show_footer() + function showNav($selected = 'Home') { - $footer = '
'; - echo $footer; - } - function show_login_form() - { + $this->elementStart('dl', array("id" => 'site_nav_local_views')); + $this->element('dt', null, _('Local Views')); + $this->elementStart('dd'); - $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('ul', array('class' => 'nav')); - function render_notice($notice) - { + $this->elementStart('li', array('class' => + ($selected == 'Home') ? 'current' : 'facebook_home')); + $this->element('a', + array('href' => 'index.php', 'title' => _('Home')), _('Home')); + $this->elementEnd('li'); - global $config; + $this->elementStart('li', + array('class' => + ($selected == 'Invite') ? 'current' : 'facebook_invite')); + $this->element('a', + array('href' => 'invite.php', 'title' => _('Invite')), _('Invite')); + $this->elementEnd('li'); - $profile = $notice->getProfile(); - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); + $this->elementStart('li', + array('class' => + ($selected == 'Settings') ? 'current' : 'facebook_settings')); + $this->element('a', + array('href' => 'settings.php', + 'title' => _('Settings')), _('Settings')); + $this->elementEnd('li'); - $noticeurl = common_local_url('shownotice', array('notice' => $notice->id)); + $this->elementEnd('ul'); - # 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; - } + $this->elementEnd('dd'); + $this->elementEnd('dl'); - $html = - '
  • ' - .'' - .'';
+    function showInstructions()
+    {
+        global $xw;
 
-        if ($profile->fullname) {
-            $html .= $profile->fullname;
-        } else {
-            $html .= $profile->nickname;
-        }
+        $this->elementStart('dl', array('class' => 'system_notice'));
+        $this->element('dt', null, 'Page Notice');
 
-        $html .=
-        '' - .'' . $profile->nickname . '' - .'

    ' . $notice->rendered . '

    ' - .'

    ' - .''; + $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . + 'with your username and password. Don\'t have a username yet? '); - if ($notice->source) { - $html .= _(' from '); - $html .= $this->source_link($notice->source); - } + $loginmsg_part2 = _(' a new account.'); - if ($notice->reply_to) { - $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); - $html .= - ' (' . _('in reply to...') . ')'; - } + $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'); + } + + function showStylesheets() + { + global $xw; - $html .= '

  • '; + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => getFacebookBaseCSS())); - return $html; + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => getFacebookThemeCSS())); } - function source_link($source) + function showScripts() { - $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; - } + global $xw; - $html .= ''; + $this->element('script', array('type' => 'text/javascript', + 'src' => getFacebookJS())); - return $html; } - function pagination($have_before, $have_after, $page, $fbaction, $args=null) + function showLoginForm($msg = null) { + startFBML(); - $html = ''; + $this->showStylesheets(); + $this->showScripts(); - if ($have_before || $have_after) { - $html = '