]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge commit 'refs/merge-requests/37' of https://gitorious.org/social/mainline into...
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 8 Feb 2015 22:21:28 +0000 (23:21 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 8 Feb 2015 22:21:28 +0000 (23:21 +0100)
13 files changed:
CONFIGURE
README.md
actions/networkpublic.php
classes/Managed_DataObject.php
lib/microappplugin.php
lib/util.php
plugins/AntiBrute/AntiBrutePlugin.php
plugins/Bookmark/BookmarkPlugin.php
plugins/Bookmark/css/bookmark.css
plugins/OStatus/actions/pushhub.php
plugins/OStatus/classes/FeedSub.php
plugins/OStatus/classes/HubSub.php
plugins/OStatus/classes/Ostatus_source.php

index 644c90452f96ddf9b5c008021fd7eb319946c67b..217b32cc7c98d250b53f46502238016ba96e136e 100644 (file)
--- a/CONFIGURE
+++ b/CONFIGURE
@@ -538,6 +538,8 @@ in php.ini to be large enough to handle your upload. In httpd.conf
 (if you're using apache), check that the LimitRequestBody directive isn't
 set too low (it's optional, so it may not be there at all).
 
+process_links: follow redirects and save all available file information
+    (mimetype, date, size, oembed, etc.). Defaults to true.
 file_quota: maximum size for a single file upload in bytes. A user can send
     any amount of notices with attachments as long as each attachment
     is smaller than file_quota.
index 0bf73ae44cc051f6156dd38ec7e5829595852cbd..806ab5f7bc3ebb5c53993933218ec7b7064a4753 100644 (file)
--- a/README.md
+++ b/README.md
@@ -52,9 +52,7 @@ service, Identi.ca <http://identi.ca/>.
 It is shared with you in hope that you too make an
 service available to your users. To learn more,
 please see the Open Software Service Definition
-1.1:
-
-    http://www.opendefinition.org/ossd
+1.1: <http://www.opendefinition.org/ossd>
 
 ### License
 
@@ -82,16 +80,16 @@ License along with this program, in the file "COPYING".  If not, see
 
 Documentation in the /doc-src/ directory is available under the
 Creative Commons Attribution 3.0 Unported license, with attribution to
-"GNU social". See http://creativecommons.org/licenses/by/3.0/ for details.
+"GNU social". See <http://creativecommons.org/licenses/by/3.0/> for details.
 
 CSS and images in the /theme/ directory are available under the
 Creative Commons Attribution 3.0 Unported license, with attribution to
-"GNU social". See http://creativecommons.org/licenses/by/3.0/ for details.
+"GNU social". See <http://creativecommons.org/licenses/by/3.0/> for details.
 
 Our understanding and intention is that if you add your own theme that
 uses only CSS and images, those files are not subject to the copyleft
 requirements of the Affero General Public License 3.0. See
-http://wordpress.org/news/2009/07/themes-are-gpl-too/ . This is not
+<http://wordpress.org/news/2009/07/themes-are-gpl-too/>. This is not
 legal advice; consult your lawyer.
 
 Additional library software has been made available in the 'extlib'
@@ -108,7 +106,7 @@ All 1.1.1 sites should upgrade to this version.
 
 So far it includes the following changes:
 
-- XSS security fix (thanks Simon Waters, https://www.surevine.com/ )
+- XSS security fix (thanks Simon Waters, <https://www.surevine.com/> )
 
 Upgrades from _StatusNet_ 1.1.1 will also experience these improvements:
 
@@ -157,13 +155,13 @@ To keep it up-to-date, use 'git pull'. Watch for conflicts!
 There are several ways to get more information about GNU social.
 
 * The #social IRC channel on freenode.net <http://www.freenode.net/>.
-* The GNU social website
-* Following us on GNU social -- http://quitter.se/gnusocial
+* The GNU social website <http://gnu.io/social/>
+* Following us on GNU social -- <http://quitter.se/gnusocial>
 
 * GNU social has a bug tracker for any defects you may find, or ideas for
-  making things better. http://bugz.foocorp.net/
+  making things better. <http://bugz.foocorp.net/>
 * Patches are welcome, either on the bug tracker or our repository at
-  Gitorious. https://gitorious.org/social/mainline
+  Gitorious. <https://gitorious.org/social/mainline>
 
 Credits
 =======
index 79e642b773e0a13ef636a0fbe4e7fdf927538d09..7baa313bee3313a0e68274090e3d53ed2c641671 100644 (file)
@@ -61,20 +61,20 @@ class NetworkpublicAction extends PublicAction
         return array(new Feed(Feed::JSON,
                               common_local_url('ApiTimelineNetworkPublic',
                                                array('format' => 'as')),
-                              // TRANS: Link description for public timeline feed.
-                              _('Public Timeline Feed (Activity Streams JSON)')),
+                              // TRANS: Link description for the _global_ network public timeline feed.
+                              _('Network Public Timeline Feed (Activity Streams JSON)')),
                     new Feed(Feed::RSS1, common_local_url('publicrss'),
-                              // TRANS: Link description for public timeline feed.
-                              _('Public Timeline Feed (RSS 1.0)')),
+                              // TRANS: Link description for the _global_ network public timeline feed.
+                              _('Network Public Timeline Feed (RSS 1.0)')),
                      new Feed(Feed::RSS2,
                               common_local_url('ApiTimelineNetworkPublic',
                                                array('format' => 'rss')),
-                              // TRANS: Link description for public timeline feed.
-                              _('Public Timeline Feed (RSS 2.0)')),
+                              // TRANS: Link description for the _global_ network public timeline feed.
+                              _('Network Public Timeline Feed (RSS 2.0)')),
                      new Feed(Feed::ATOM,
                               common_local_url('ApiTimelineNetworkPublic',
                                                array('format' => 'atom')),
-                              // TRANS: Link description for public timeline feed.
-                              _('Public Timeline Feed (Atom)')));
+                              // TRANS: Link description for the _global_ network public timeline feed.
+                              _('Network Public Timeline Feed (Atom)')));
     }
 }
index 5ed0e525eab3ab63e36a33e56282a4115a7b2760..a628b8bee3aa1834879ecae689e4c9ca40ce2940 100644 (file)
@@ -353,6 +353,10 @@ abstract class Managed_DataObject extends Memcached_DataObject
             }
             $orig->decache();
             $this->encache();
+
+            // commit our db transaction since we won't reach the COMMIT below
+            $this->query('COMMIT');
+            // @FIXME return true only if something changed (otherwise 0)
             return true;
         }
 
@@ -384,6 +388,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
 
         // commit our db transaction
         $this->query('COMMIT');
+        // @FIXME return true only if something changed (otherwise 0)
         return $result;
     }
 }
index d9a00f7ee568f0166e9ce84e63e6cb54a32c1315..53fe5e9995eab4d7bf467c7015d769c8122dbd04 100644 (file)
@@ -104,8 +104,7 @@ abstract class MicroAppPlugin extends ActivityHandlerPlugin
 
         $adapter->showNotice();
         $adapter->showNoticeAttachments();
-        $adapter->showNoticeInfo();
-        $adapter->showNoticeOptions();
+        $adapter->showNoticeFooter();
 
         return false;
     }
index c365c560c233be58add270b3f98292414dd55392..a32c35395eb91ba004f48d43b828110195d54159 100644 (file)
@@ -383,6 +383,7 @@ function common_rememberme($user=null)
 
     if (!$result) {
         common_log_db_error($rm, 'INSERT', __FILE__);
+        $rm->query('ROLLBACK');
         return false;
     }
 
index 342c323016457a397a0e6f0fdef4447f25dfc9c1..365937fedf9bf4d1a6c27bbfbce31e8d1d946415 100755 (executable)
@@ -23,7 +23,8 @@ class AntiBrutePlugin extends Plugin {
         }
 
         // This probably needs some work. For example with IPv6 you can easily generate new IPs...
-        $this->client_ip = common_client_ip()[0] ?: common_client_ip()[1];   // [0] is proxy, [1] should be the real IP
+        $client_ip = common_client_ip();
+        $this->client_ip = $client_ip[0] ?: $client_ip[1];   // [0] is proxy, [1] should be the real IP
         $this->failed_attempts = (int)$this->unauthed_user->getPref(self::FAILED_LOGIN_IP_SECTION, $this->client_ip);
         switch (true) {
         case $this->failed_attempts >= 5:
index 9ea83c4caf1f2263f43ff3952b5e550093b585fc..2426deb93f5658dc538dcacab602b5f17316f766 100644 (file)
@@ -536,6 +536,12 @@ class BookmarkPlugin extends MicroAppPlugin
         $replies = $stored->getReplies();
         $tags = $stored->getTags();
 
+        if (!empty($nb->description)) {
+            $out->element('p',
+                          array('class' => 'bookmark-description'),
+                          $nb->description);
+        }
+
         if (!empty($replies) || !empty($tags)) {
 
             $out->elementStart('ul', array('class' => 'bookmark-tags'));
@@ -569,10 +575,5 @@ class BookmarkPlugin extends MicroAppPlugin
             $out->elementEnd('ul');
         }
 
-        if (!empty($nb->description)) {
-            $out->element('p',
-                          array('class' => 'bookmark-description'),
-                          $nb->description);
-        }
     }
 }
index 7d10957c685bd3196ef6abb6780a33e56f82ec94..e785664f8146b80b1e05831b5bcdfd31ac91b95f 100644 (file)
@@ -3,8 +3,7 @@
 .bookmark-tags li { display: inline; }
 
 .bookmark h3 {
-    margin: 0px 0px 8px 0px;
-    line-height: 3em;
+    margin: 4px 0px 8px 0px;
 }
 
 .bookmark-notice-count {
@@ -42,7 +41,7 @@
 
 .bookmark-tags {
     clear: both;
-    margin-bottom: 8px;
+    margin-bottom: 4px;
     line-height: 1.6em;
 }
 
index fb41c42ad354002ba5a5b78b83216e2166c065a6..5ab1fc23d833d435787eda24144c363ee15dcc93 100644 (file)
@@ -133,54 +133,61 @@ class PushHubAction extends Action
      * user or group Atom feeds.
      *
      * @param string $feed URL
-     * @return boolean true if it matches
+     * @return boolean true if it matches, false if not a recognized local feed
+     * @throws exception if local entity does not exist
      */
-    function recognizedFeed($feed)
+    protected function recognizedFeed($feed)
     {
         $matches = array();
+        // Simple mapping to local ID for user or group
         if (preg_match('!/(\d+)\.atom$!', $feed, $matches)) {
             $id = $matches[1];
             $params = array('id' => $id, 'format' => 'atom');
-            $userFeed = common_local_url('ApiTimelineUser', $params);
-            $groupFeed = common_local_url('ApiTimelineGroup', $params);
 
-            if ($feed == $userFeed) {
+            // Double-check against locally generated URLs
+            switch ($feed) {
+            case common_local_url('ApiTimelineUser', $params):
                 $user = User::getKV('id', $id);
-                if (!$user) {
+                if (!$user instanceof User) {
                     // TRANS: Client exception. %s is a feed URL.
-                    throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
-                } else {
-                    return true;
+                    throw new ClientException(sprintf(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
                 }
-            }
-            if ($feed == $groupFeed) {
-                $user = User_group::getKV('id', $id);
-                if (!$user) {
+                return true;
+
+            case common_local_url('ApiTimelineGroup', $params):
+                $group = Local_group::getKV('group_id', $id);
+                if (!$group instanceof Local_group) {
                     // TRANS: Client exception. %s is a feed URL.
-                    throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'),$feed));
-                } else {
-                    return true;
+                    throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Local_group does not exist.'),$feed));
                 }
+                return true;
             }
-        } else if (preg_match('!/(\d+)/lists/(\d+)/statuses\.atom$!', $feed, $matches)) {
+            common_debug("Feed was not recognized by any local User or Group Atom feed URLs: {$feed}");
+            return false;
+        }
+
+        // Profile lists are unique per user, so we need both IDs
+        if (preg_match('!/(\d+)/lists/(\d+)/statuses\.atom$!', $feed, $matches)) {
             $user = $matches[1];
             $id = $matches[2];
             $params = array('user' => $user, 'id' => $id, 'format' => 'atom');
-            $listFeed = common_local_url('ApiTimelineList', $params);
 
-            if ($feed == $listFeed) {
+            // Double-check against locally generated URLs
+            switch ($feed) {
+            case common_local_url('ApiTimelineList', $params):
                 $list = Profile_list::getKV('id', $id);
                 $user = User::getKV('id', $user);
-                if (!$list || !$user || $list->tagger != $user->id) {
+                if (!$list instanceof Profile_list || !$user instanceof User || $list->tagger != $user->id) {
                     // TRANS: Client exception. %s is a feed URL.
                     throw new ClientException(sprintf(_m('Invalid hub.topic %s; list does not exist.'),$feed));
-                } else {
-                    return true;
                 }
+                return true;
             }
-            common_log(LOG_DEBUG, "Not a user, group or people tag feed? $feed $userFeed $groupFeed $listFeed");
+            common_debug("Feed was not recognized by any local Profile_list Atom feed URL: {$feed}");
+            return false;
         }
-        common_log(LOG_DEBUG, "LOST $feed");
+
+        common_debug("Unknown feed URL structure, can't match against local user, group or profile_list: {$feed}");
         return false;
     }
 
index 57c056f5fbd7f3b29849221d56b40ffc65ab4e23..adc1aa11be6506eb9041a85db5b1924c53180131 100644 (file)
@@ -86,7 +86,7 @@ class FeedSub extends Managed_DataObject
                 'sub_state' => array('type' => 'enum("subscribe","active","unsubscribe","inactive","nohub")', 'not null' => true, 'description' => 'subscription state'),
                 'sub_start' => array('type' => 'datetime', 'description' => 'subscription start'),
                 'sub_end' => array('type' => 'datetime', 'description' => 'subscription end'),
-                'last_update' => array('type' => 'datetime', 'not null' => true, 'description' => 'when this record was last updated'),
+                'last_update' => array('type' => 'datetime', 'description' => 'when this record was last updated'),
                 '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 30c32ac1aa2b18c1089063a99f0a0ae8a91fa9b8..96c6986cdf7923b7446e25b43f98179baeec2831 100644 (file)
@@ -58,7 +58,7 @@ class HubSub extends Managed_DataObject
                 'topic' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'HubSub topic'),
                 'callback' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'HubSub callback'),
                 'secret' => array('type' => 'text', 'description' => 'HubSub stored secret'),
-                'lease' => array('type' => 'int', 'not null' => true, 'description' => 'HubSub leasetime'),
+                'lease' => array('type' => 'int', 'description' => 'HubSub leasetime'),
                 'sub_start' => array('type' => 'datetime', 'description' => 'subscription start'),
                 'sub_end' => array('type' => 'datetime', 'description' => 'subscription end'),
                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
index d122a7e7f4f06622f2ea13b1ea43e19af02fc855..6cecc323e0986e8247a9b218598b8c857f443ba8 100644 (file)
@@ -66,6 +66,7 @@ class Ostatus_source extends Managed_DataObject
         $osource->notice_id = $notice->id;
         $osource->profile_uri = $oprofile->uri;
         $osource->method = $method;
+        $osource->created = common_sql_now();
         if ($osource->insert()) {
            return true;
         } else {