]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/facebookhome.php
Updated config.php.sample with example Tag URI configs
[quix0rs-gnu-social.git] / actions / facebookhome.php
index 3558cf671bf15e8bcf976e5f7b0c00377729bf98..5946e6c984b36190428c31c28c095f43b12180e8 100644 (file)
@@ -43,11 +43,11 @@ class FacebookhomeAction extends FacebookAction
     function handle($args)
     {
         parent::handle($args);        
-        
+                
         // If the user has opted not to initially allow the app to have
         // Facebook status update permission, store that preference. Only
         // promt the user the first time she uses the app
-        if ($this->arg('skip')) {
+        if ($this->arg('skip') || $args['fb_sig_request_method'] == 'GET') {
             $this->facebook->api_client->data_setUserPreference(
                 FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
         }
@@ -89,7 +89,7 @@ class FacebookhomeAction extends FacebookAction
         }
 
     }
-
+    
     function login()
     {
         
@@ -122,7 +122,6 @@ class FacebookhomeAction extends FacebookAction
                 // XXX: Do some error handling here
 
                 $this->setDefaults();
-                //$this->showHome($flink, _('You can now use Identi.ca from Facebook!'));
 
                 $this->getUpdatePermission();
                 return;
@@ -133,6 +132,7 @@ class FacebookhomeAction extends FacebookAction
         }
 
         $this->showLoginForm($msg);
+        $this->showFooter();
 
     }
 
@@ -148,7 +148,6 @@ class FacebookhomeAction extends FacebookAction
 
     function showNoticeForm()
     {
-        
         $post_action = "$this->app_uri/index.php";
         
         $notice_form = new FacebookNoticeForm($this, $post_action, null, 
@@ -167,7 +166,6 @@ class FacebookhomeAction extends FacebookAction
 
     function showContent()
     {
-
         $notice = $this->user->noticesWithFriends(($this->page-1) *
             NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
         
@@ -177,7 +175,6 @@ class FacebookhomeAction extends FacebookAction
 
         $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
                           $this->page, 'index.php', array('nickname' => $this->user->nickname));
-
     }
 
     function showNoticeList($notice)
@@ -191,7 +188,7 @@ class FacebookhomeAction extends FacebookAction
 
         $this->showStylesheets();
 
-        $this->elementStart('div', array('class' => 'content'));
+        $this->elementStart('div', array('class' => 'facebook_guide'));
 
         $instructions = sprintf(_('If you would like the %s app to automatically update ' .
             'your Facebook status with your latest notice, you need ' .
@@ -207,11 +204,19 @@ class FacebookhomeAction extends FacebookAction
 
         $this->elementStart('ul', array('id' => 'fb-permissions-list'));
         $this->elementStart('li', array('id' => 'fb-permissions-item'));
-        $this->elementStart('fb:prompt-permission', array('perms' => 'status_update',
-            'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/index.php" . '\')'));
-        $this->element('span', array('class' => 'facebook-button'),
-            sprintf(_('Allow %s to update my Facebook status'), $this->app_name));
-        $this->elementEnd('fb:prompt-permission');
+        
+        $next = urlencode("$this->app_uri/index.php");
+        $api_key = common_config('facebook', 'apikey');
+        
+        $auth_url = 'http://www.facebook.com/authorize.php?api_key=' .
+            $api_key . '&v=1.0&ext_perm=status_update&next=' . $next . 
+            '&next_cancel=' . $next . '&submit=skip';
+        
+        $this->elementStart('span', array('class' => 'facebook-button'));
+        $this->element('a', array('href' => $auth_url), 
+            sprintf(_('Okay, do it!'), $this->app_name));
+        $this->elementEnd('span');
+
         $this->elementEnd('li');
 
         $this->elementStart('li', array('id' => 'fb-permissions-item'));
@@ -223,53 +228,6 @@ class FacebookhomeAction extends FacebookAction
         $this->elementEnd('div');
 
     }
-
-    function saveNewNotice()
-    {
-
-        $user = $this->flink->getUser();
-
-        $content = $this->trimmed('status_textarea');
-        
-        if (!$content) {
-            $this->showPage(_('No notice content!'));
-            return;
-        } else {
-            $content_shortened = common_shorten_links($content);
-
-            if (mb_strlen($content_shortened) > 140) {
-                common_debug("Content = '$content_shortened'", __FILE__);
-                common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
-                $this->showPage(_('That\'s too long. Max notice size is 140 chars.'));
-                return;
-            }
-        }
-
-        $inter = new CommandInterpreter();
-
-        $cmd = $inter->handle_command($user, $content_shortened);
-
-        if ($cmd) {
-            
-            // XXX fix this
-            
-            $cmd->execute(new WebChannel());
-            return;
-        }
-
-        $replyto = $this->trimmed('inreplyto');
-
-        $notice = Notice::saveNew($user->id, $content,
-            'Facebook', 1, ($replyto == 'false') ? null : $replyto);
-
-        if (is_string($notice)) {
-            $this->showPage($notice);
-            return;
-        }
-
-        common_broadcast_notice($notice);
-        
-    }
     
     /**
      * Generate pagination links