]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/facebookaction.php
change LACONICA to STATUSNET
[quix0rs-gnu-social.git] / lib / facebookaction.php
index a445750f7e00eee711f054a200c7ebc0dbd0f75e..e7c78f070c9a0314b2b48f86958f322916a3e018 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Low-level generator for HTML
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Faceboook
- * @package   Laconica
- * @author    Zach Copley <zach@controlyourself.ca>
- * @copyright 2008 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Zach Copley <zach@status.net>
+ * @copyright 2008 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA'))
+if (!defined('STATUSNET'))
 {
     exit(1);
 }
@@ -95,34 +95,13 @@ class FacebookAction extends Action
 
     function showStylesheets()
     {
-        // Add a timestamp to the file so Facebook cache wont ignore our changes
-        $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css');
-
-    $this->element('link', array('rel' => 'stylesheet',
-               'type' => 'text/css',
-               'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts));
-
-        $theme = common_config('site', 'theme');
-
-        $ts = filemtime(INSTALLDIR. '/theme/' . $theme .'/css/display.css');
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/display.css', null) . '?ts=' . $ts));
-
-        $ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.css');
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/facebookapp.css', 'base') . '?ts=' . $ts));
+        $this->cssLink('css/display.css', 'base');
+        $this->cssLink('css/facebookapp.css', 'base');
     }
 
     function showScripts()
     {
-        // Add a timestamp to the file so Facebook cache wont ignore our changes
-        $ts = filemtime(INSTALLDIR.'/js/facebookapp.js');
-
-        $this->element('script', array('src' => common_path('js/facebookapp.js') . '?ts=' . $ts));
+        $this->script('js/facebookapp.js');
     }
 
     /**
@@ -213,12 +192,14 @@ class FacebookAction extends Action
             array('href' => 'index.php', 'title' => _('Home')), _('Home'));
         $this->elementEnd('li');
 
-        $this->elementStart('li',
-            array('class' =>
-                ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
-        $this->element('a',
-            array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
-        $this->elementEnd('li');
+        if (common_config('invite', 'enabled')) {
+            $this->elementStart('li',
+                array('class' =>
+                    ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
+            $this->element('a',
+                array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
+            $this->elementEnd('li');
+        }
 
         $this->elementStart('li',
             array('class' =>
@@ -275,8 +256,13 @@ class FacebookAction extends Action
         $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'));
+        if (!common_config('site', 'openidonly')) {
+            $this->element('a',
+                array('href' => common_local_url('register')), _('Register'));
+        } else {
+            $this->element('a',
+                array('href' => common_local_url('openidlogin')), _('Register'));
+        }
         $this->text($loginmsg_part2);
     $this->elementEnd('p');
         $this->elementEnd('dd');
@@ -458,16 +444,6 @@ class FacebookAction extends Action
         }
     }
 
-    function updateFacebookStatus($notice)
-    {
-        $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, $this->fbuid);
-        $content = "$prefix $notice->content";
-
-        if ($this->facebook->api_client->users_hasAppPermission('status_update', $this->fbuid)) {
-            $this->facebook->api_client->users_setStatus($content, $this->fbuid, false, true);
-        }
-    }
-
     function saveNewNotice()
     {
 
@@ -502,7 +478,7 @@ class FacebookAction extends Action
         $replyto = $this->trimmed('inreplyto');
 
         $notice = Notice::saveNew($user->id, $content,
-            'Facebook', 1, ($replyto == 'false') ? null : $replyto);
+            'web', 1, ($replyto == 'false') ? null : $replyto);
 
         if (is_string($notice)) {
             $this->showPage($notice);
@@ -512,8 +488,7 @@ class FacebookAction extends Action
         common_broadcast_notice($notice);
 
         // Also update the user's Facebook status
-        $this->updateFacebookStatus($notice);
-        $this->updateProfileBox($notice);
+        facebookBroadcastNotice($notice);
 
     }