]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Removing MicroID as well as simplifying profileaction
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 14 Jul 2015 14:52:20 +0000 (16:52 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 14 Jul 2015 14:52:20 +0000 (16:52 +0200)
sorry, forgot to commit in between

12 files changed:
actions/emailsettings.php
actions/groupbyid.php
actions/imsettings.php
actions/shownotice.php
actions/showstream.php
classes/User.php
classes/User_im_prefs.php
lib/galleryaction.php
lib/implugin.php
lib/microid.php [deleted file]
lib/profileaction.php
plugins/Xmpp/XmppPlugin.php

index a0f111c0d5ab6bc0a6b698b6d96fed60dda6f36d..cffc5da247da4a58811b3429934a2f4d87ab2f79 100644 (file)
@@ -231,12 +231,6 @@ class EmailsettingsAction extends SettingsAction
                             _('Allow friends to nudge me and send me an email.'),
                             $user->emailnotifynudge);
             $this->elementEnd('li');
-            $this->elementStart('li');
-            $this->checkbox('emailmicroid',
-                            // TRANS: Checkbox label in e-mail preferences form.
-                            _('Publish a MicroID for my email address.'),
-                            $user->emailmicroid);
-            $this->elementEnd('li');
             Event::handle('EndEmailFormData', array($this, $this->scoped));
         }
         $this->elementEnd('ul');
@@ -320,7 +314,6 @@ class EmailsettingsAction extends SettingsAction
             $emailnotifymsg   = $this->booleanintstring('emailnotifymsg');
             $emailnotifynudge = $this->booleanintstring('emailnotifynudge');
             $emailnotifyattn  = $this->booleanintstring('emailnotifyattn');
-            $emailmicroid     = $this->booleanintstring('emailmicroid');
             $emailpost        = $this->booleanintstring('emailpost');
 
             $user->query('BEGIN');
@@ -331,7 +324,6 @@ class EmailsettingsAction extends SettingsAction
             $user->emailnotifymsg   = $emailnotifymsg;
             $user->emailnotifynudge = $emailnotifynudge;
             $user->emailnotifyattn  = $emailnotifyattn;
-            $user->emailmicroid     = $emailmicroid;
             $user->emailpost        = $emailpost;
 
             $result = $user->update($original);
index b82a861e97319931b3f322cd1024e59e241969bf..8556675155262dc61d51c072c671409f3b3aba87 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/noticelist.php';
-require_once INSTALLDIR.'/lib/feedlist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Permalink for a group
index 92fff45a7db6d27f506be1f50520afb717b685af..feb5d32fc18a2b8413b05bf0a1ef2b88e927333e 100644 (file)
@@ -179,8 +179,6 @@ class ImsettingsAction extends SettingsAction
                 // TRANS: Checkbox label in IM preferences form.
                 array('name'=>'replies', 'description'=>_('Send me replies '.
                               'from people I\'m not subscribed to.')),
-                // TRANS: Checkbox label in IM preferences form.
-                array('name'=>'microid', 'description'=>_('Publish a MicroID'))
             );
             foreach($preferences as $preference)
             {
@@ -277,7 +275,7 @@ class ImsettingsAction extends SettingsAction
         $user_im_prefs->user_id = $user->id;
         if($user_im_prefs->find() && $user_im_prefs->fetch())
         {
-            $preferences = array('notify', 'updatefrompresence', 'replies', 'microid');
+            $preferences = array('notify', 'updatefrompresence', 'replies');
             do
             {
                 $original = clone($user_im_prefs);
index 4a1adfd7de938aac1061cb6d93c93e01363c736b..23386868ddbc1b042b3151b29340b952c86cf35c 100644 (file)
@@ -222,25 +222,12 @@ class ShownoticeAction extends ManagedAction
     /**
      * Extra <head> content
      *
-     * We show the microid(s) for the author, if any.
+     * Facebook OpenGraph metadata.
      *
      * @return void
      */
     function extraHead()
     {
-        $user = User::getKV($this->profile->id);
-
-        if (!$user instanceof User) {
-            return;
-        }
-
-        if ($user->emailmicroid && $user->email && $this->notice->uri) {
-            $id = new Microid('mailto:'. $user->email,
-                              $this->notice->uri);
-            $this->element('meta', array('name' => 'microid',
-                                         'content' => $id->toString()));
-        }
-
         // Extras to aid in sharing notices to Facebook
         $avatarUrl = $this->profile->avatarUrl(AVATAR_PROFILE_SIZE);
         $this->element('meta', array('property' => 'og:image',
index 51384eb487534a5f508fa63b23573018bee3cffe..890c1e711b316a99207fb7a2ac736cb2ba70264c 100644 (file)
@@ -47,38 +47,6 @@ if (!defined('GNUSOCIAL')) { exit(1); }
  */
 class ShowstreamAction extends NoticestreamAction
 {
-    protected $target = null;
-
-    protected function doPreparation()
-    {
-        // showstream requires a nickname
-        $nickname_arg = $this->trimmed('nickname');
-        $nickname     = common_canonical_nickname($nickname_arg);
-
-        // Permanent redirect on non-canonical nickname
-        if ($nickname_arg != $nickname) {
-            $args = array('nickname' => $nickname);
-            if ($this->arg('page') && $this->arg('page') != 1) {
-                $args['page'] = $this->arg['page'];
-            }
-            common_redirect(common_local_url($this->getActionName(), $args), 301);
-        }
-
-        try {
-            $user = User::getByNickname($nickname);
-        } catch (NoSuchUserException $e) {
-            $group = Local_group::getKV('nickname', $nickname);
-            if ($group instanceof Local_group) {
-                common_redirect($group->getProfile()->getUrl());
-            }
-
-            // No user nor group found, throw the NoSuchUserException again
-            throw $e;
-        }
-
-        $this->target = $user->getProfile();
-    }
-
     public function getStream()
     {
         if (empty($this->tag)) {
@@ -195,13 +163,6 @@ class ShowstreamAction extends NoticestreamAction
                                          'content' => $this->target->getDescription()));
         }
 
-        if ($this->target->isLocal() && $this->target->getUser()->emailmicroid && $this->target->getUser()->email && $this->target->getUrl()) {
-            $id = new Microid('mailto:'.$this->target->getUser()->email,
-                              $this->selfUrl());
-            $this->element('meta', array('name' => 'microid',
-                                         'content' => $id->toString()));
-        }
-
         // See https://wiki.mozilla.org/Microsummaries
 
         $this->element('link', array('rel' => 'microsummary',
index ec6ceccf1244c79e6c48f608b4b274488274dc4a..e1ce33be181dad1e387e3b0143301abd2dfe0c6d 100644 (file)
@@ -42,7 +42,6 @@ class User extends Managed_DataObject
     public $emailnotifynudge;                // tinyint(1)   default_1
     public $emailnotifymsg;                  // tinyint(1)   default_1
     public $emailnotifyattn;                 // tinyint(1)   default_1
-    public $emailmicroid;                    // tinyint(1)   default_1
     public $language;                        // varchar(50)
     public $timezone;                        // varchar(50)
     public $emailpost;                       // tinyint(1)   default_1
@@ -77,7 +76,6 @@ class User extends Managed_DataObject
                 'emailnotifynudge' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of nudges'),
                 'emailnotifymsg' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of direct messages'),
                 'emailnotifyattn' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of @-replies'),
-                'emailmicroid' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'whether to publish email microid'),
                 'language' => array('type' => 'varchar', 'length' => 50, 'description' => 'preferred language'),
                 'timezone' => array('type' => 'varchar', 'length' => 50, 'description' => 'timezone'),
                 'emailpost' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Post by email'),
@@ -276,9 +274,7 @@ class User extends Managed_DataObject
         $user->emailnotifynudge = 1;
         $user->emailnotifymsg = 1;
         $user->emailnotifyattn = 1;
-        $user->emailmicroid = 1;
         $user->emailpost = 1;
-        $user->jabbermicroid = 1;
 
         $user->created = common_sql_now();
 
index 16fd030bb42ce43c35307ef4d8826fb3fa5fd263..6a5fc7f3ab55a70b4df8f8b060d5bba2c3e97c20 100644 (file)
@@ -40,7 +40,6 @@ class User_im_prefs extends Managed_DataObject
     public $transport;                       // varchar(191)  not_null   not 255 because utf8mb4 takes more space
     public $notify;                          // tinyint(1)
     public $replies;                         // tinyint(1)
-    public $microid;                         // tinyint(1)
     public $updatefrompresence;              // tinyint(1)
     public $created;                         // datetime   not_null default_0000-00-00%2000%3A00%3A00
     public $modified;                        // timestamp   not_null default_CURRENT_TIMESTAMP
@@ -57,7 +56,6 @@ class User_im_prefs extends Managed_DataObject
                 'transport' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'),
                 'notify' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Notify when a new notice is sent'),
                 'replies' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies  from people not subscribed to'),
-                'microid' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'Publish a MicroID'),
                 'updatefrompresence' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to.'),
                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
                 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
index f87043ac063840ced2c0d16fed372e1d2f0e1a45..5dd0cfcfa766c9843baa364a4f5c14f3d8f2a031 100644 (file)
@@ -36,35 +36,6 @@ class GalleryAction extends ProfileAction
         parent::handle();
     }
 
-    protected function doPreparation()
-    {
-        // showstream requires a nickname
-        $nickname_arg = $this->arg('nickname');
-        $nickname     = common_canonical_nickname($nickname_arg);
-
-        // Permanent redirect on non-canonical nickname
-
-        if ($nickname_arg != $nickname) {
-            $args = array('nickname' => $nickname);
-            if ($this->arg('page') && $this->arg('page') != 1) {
-                $args['page'] = $this->arg['page'];
-            }
-            common_redirect(common_local_url($this->getActionName(), $args), 301);
-        }
-        $this->user = User::getKV('nickname', $nickname);
-
-        if (!$this->user) {
-            $group = Local_group::getKV('nickname', $nickname);
-            if ($group instanceof Local_group) {
-                common_redirect($group->getProfile()->getUrl());
-            }
-            // TRANS: Client error displayed when calling a profile action without specifying a user.
-            $this->clientError(_('No such user.'), 404);
-        }
-
-        $this->target = $this->user->getProfile();
-    }
-
     function showContent()
     {
         $this->showTagsDropdown();
index 87ca03716089dc4c06f5b7f419d964d8c47fde27..6395ecbdb79155cde5cf9018e7418cbb4826c7ed 100644 (file)
@@ -126,17 +126,6 @@ abstract class ImPlugin extends Plugin
      */
     abstract function daemonScreenname();
 
-    /**
-     * get the microid uri of a given screenname
-     *
-     * @param string $screenname screenname
-     *
-     * @return string microid uri
-     */
-    function microiduri($screenname)
-    {
-        return $this->transport . ':' . $screenname;
-    }
     //========================UTILITY FUNCTIONS USEFUL TO IMPLEMENTATIONS - MISC ========================\
 
     /**
@@ -571,25 +560,12 @@ abstract class ImPlugin extends Plugin
             $user_im_prefs->user_id = $action->notice->getProfile()->getID();
             $user_im_prefs->transport = $this->transport;
 
-            if ($user_im_prefs->find() && $user_im_prefs->fetch() && $user_im_prefs->microid && $action->notice->uri) {
-                $id = new Microid($this->microiduri($user_im_prefs->screenname),
-                                  $action->notice->uri);
-                $action->element('meta', array('name' => 'microid',
-                                             'content' => $id->toString()));
-            }
-
         } elseif ($action instanceof ShowstreamAction) {
 
             $user_im_prefs = new User_im_prefs();
             $user_im_prefs->user_id = $action->getTarget()->getID();
             $user_im_prefs->transport = $this->transport;
 
-            if ($user_im_prefs->find() && $user_im_prefs->fetch() && $user_im_prefs->microid && $action->getTarget()->getUrl()) {
-                $id = new Microid($this->microiduri($user_im_prefs->screenname),
-                                  $action->selfUrl());
-                $action->element('meta', array('name' => 'microid',
-                                               'content' => $id->toString()));
-            }
         }
     }
 
diff --git a/lib/microid.php b/lib/microid.php
deleted file mode 100644 (file)
index e2e7d76..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Microid class
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  ID
- * @package   StatusNet
- * @author    Evan Prodromou <evan@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://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * A class for microids
- *
- * @category ID
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- * @see      http://microid.org/
- */
-
-class Microid
-{
-    /** Agent part of the ID. */
-
-    var $agent = null;
-
-    /** Resource part of the ID. */
-
-    var $resource = null;
-
-    /**
-     * Constructor
-     *
-     * @param string $agent    Agent of the ID
-     * @param string $resource Resource part
-     */
-
-    function __construct($agent, $resource)
-    {
-        $this->agent    = $agent;
-        $this->resource = $resource;
-
-    }
-
-    /**
-     * Generate a MicroID string
-     *
-     * @return string MicroID for agent and resource
-     */
-
-    function toString()
-    {
-        $agent_proto    = $this->_getProto($this->agent);
-        $resource_proto = $this->_getProto($this->resource);
-
-        return $agent_proto.'+'.$resource_proto.':sha1:'.
-          sha1(sha1($this->agent).sha1($this->resource));
-    }
-
-    /**
-     * Utility for getting the protocol part of a URI
-     *
-     * @param string $uri URI to parse
-     *
-     * @return string scheme part of the URI
-     */
-
-    function _getProto($uri)
-    {
-        $colon = strpos($uri, ':');
-        return substr($uri, 0, $colon);
-    }
-}
index 5a5d526e42065f6bd5974c535e4c0e516000c644..3dc28a7cc48fd56ec6f4de30588660373e2d1584 100644 (file)
@@ -48,6 +48,36 @@ abstract class ProfileAction extends ManagedAction
 
     protected $target  = null;    // Profile that we're showing
 
+    protected function doPreparation()
+    {
+        // showstream requires a nickname
+        $nickname_arg = $this->trimmed('nickname');
+        $nickname     = common_canonical_nickname($nickname_arg);
+
+        // Permanent redirect on non-canonical nickname
+        if ($nickname_arg != $nickname) {
+            $args = array('nickname' => $nickname);
+            if ($this->arg('page') && $this->arg('page') != 1) {
+                $args['page'] = $this->arg['page'];
+            }
+            common_redirect(common_local_url($this->getActionName(), $args), 301);
+        }
+
+        try {
+            $user = User::getByNickname($nickname);
+        } catch (NoSuchUserException $e) {
+            $group = Local_group::getKV('nickname', $nickname);
+            if ($group instanceof Local_group) {
+                common_redirect($group->getProfile()->getUrl());
+            }
+
+            // No user nor group found, throw the NoSuchUserException again
+            throw $e;
+        }
+
+        $this->target = $user->getProfile();
+    }
+
     protected function prepare(array $args=array())
     {
         // this will call ->doPreparation() which child classes use to set $this->target
@@ -65,11 +95,6 @@ abstract class ProfileAction extends ManagedAction
         return true;
     }
 
-    protected function profileActionPreparation()
-    {
-        // Nothing to do by default.
-    }
-
     public function getTarget()
     {
         if (!$this->target instanceof Profile) {
index 0a702687359e1c95fa76b50943f7d61a887e872f..04101a8e2b933f15d6f6c06de104b7d8c63b514a 100644 (file)
@@ -308,11 +308,6 @@ class XmppPlugin extends ImPlugin
         return true;
     }
 
-    function microiduri($screenname)
-    {
-        return 'xmpp:' . $screenname;
-    }
-
     function sendMessage($screenname, $body)
     {
         $this->queuedConnection()->message($screenname, $body, 'chat');