]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Stub RemoteprofileAction to show the standard profile header stuff for offsite users...
authorBrion Vibber <brion@pobox.com>
Mon, 15 Nov 2010 23:34:12 +0000 (15:34 -0800)
committerBrion Vibber <brion@pobox.com>
Mon, 15 Nov 2010 23:34:12 +0000 (15:34 -0800)
plugins/ModPlus/ModPlusPlugin.php
plugins/ModPlus/remoteprofileaction.php [new file with mode: 0644]

index 485b821813e4577c169a397d2c958295677affc8..89bbdf857f546b01c72f1f6f89c349d7c5cfa144 100644 (file)
@@ -40,4 +40,59 @@ class ModPlusPlugin extends Plugin
 
         return true;
     }
+
+    /**
+     * Load JS at runtime if we're logged in.
+     *
+     * @param Action $action
+     * @return boolean hook result
+     */
+    function onEndShowScripts($action)
+    {
+        $user = common_current_user();
+        if ($user) {
+            $action->script('plugins/ModPlus/modplus.js');
+        }
+        return true;
+    }
+
+    /**
+     * Autoloader
+     *
+     * Loads our classes if they're requested.
+     *
+     * @param string $cls Class requested
+     *
+     * @return boolean hook return
+     */
+    function onAutoload($cls)
+    {
+        switch ($cls)
+        {
+        case 'RemoteprofileAction':
+        case 'RemoteProfileAction':
+            require_once dirname(__FILE__) . '/remoteprofileaction.php';
+            return false;
+        default:
+            return true;
+        }
+    }
+
+    /**
+     * Add OpenID-related paths to the router table
+     *
+     * Hook for RouterInitialized event.
+     *
+     * @param Net_URL_Mapper $m URL mapper
+     *
+     * @return boolean hook return
+     */
+    function onStartInitializeRouter($m)
+    {
+        $m->connect('user/remote/:id',
+                array('action' => 'remoteprofile'),
+                array('id' => '[\d]+'));
+
+        return true;
+    }
 }
diff --git a/plugins/ModPlus/remoteprofileaction.php b/plugins/ModPlus/remoteprofileaction.php
new file mode 100644 (file)
index 0000000..ca82045
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/* 
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+class RemoteProfileAction extends ShowstreamAction
+{
+    function prepare($args)
+    {
+        OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
+
+        $id = $this->arg('id');
+        $this->user = false;
+        $this->profile = Profile::staticGet('id', $id);
+
+        if (!$this->profile) {
+            $this->serverError(_('User has no profile.'));
+            return false;
+        }
+
+        $this->tag = $this->trimmed('tag');
+        $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+        common_set_returnto($this->selfUrl());
+        return true;
+    }
+
+    function handle($args)
+    {
+        // skip yadis thingy
+        $this->showPage();
+    }
+
+    function title()
+    {
+        // maybe fixed in 0.9.x
+        if (!empty($this->profile->fullname)) {
+            $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
+        } else {
+            $base = $this->profile->nickname;
+        }
+    }
+
+    function showContent()
+    {
+        $this->showProfile();
+        // don't show notices
+    }
+
+    function getFeeds()
+    {
+        // none
+    }
+
+    function extraHead()
+    {
+        // none
+    }
+    function showLocalNav()
+    {
+        // none...?
+    }
+    function showSections()
+    {
+        ProfileAction::showSections();
+        // skip tag cloud
+    }
+
+}
\ No newline at end of file