]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' into 0.9.x
authorBrion Vibber <brion@pobox.com>
Thu, 29 Apr 2010 22:14:51 +0000 (15:14 -0700)
committerBrion Vibber <brion@pobox.com>
Thu, 29 Apr 2010 22:14:51 +0000 (15:14 -0700)
Conflicts:
index.php

1  2 
classes/Notice.php
lib/activity.php

diff --combined classes/Notice.php
index 42c235b1a33c75466f05bb55914b629597e3d499,0b1b2e402dfc05178651f6134f830ab7763af75b..c0828674d17e5643b514316992644a5728e0a8a6
@@@ -172,8 -172,7 +172,8 @@@ class Notice extends Memcached_DataObje
          $id = $tag->insert();
  
          if (!$id) {
 -            throw new ServerException(sprintf(_('DB error inserting hashtag: %s'),
 +            // TRANS: Server exception. %s are the error details.
 +            throw new ServerException(sprintf(_('Database error inserting hashtag: %s'),
                                                $last_error->message));
              return;
          }
                  $reply->profile_id = $user->id;
  
                  $id = $reply->insert();
-                 self::blow('reply:stream:%d', $user->id);
              }
          }
  
                      throw new ServerException("Couldn't save reply for {$this->id}, {$mentioned->id}");
                  } else {
                      $replied[$mentioned->id] = 1;
+                     self::blow('reply:stream:%d', $mentioned->id);
                  }
              }
          }
          foreach ($recipientIds as $recipientId) {
              $user = User::staticGet('id', $recipientId);
              if (!empty($user)) {
-                 self::blow('reply:stream:%d', $recipientId);
                  mail_notify_attn($user, $this);
              }
          }
      {
          $author = Profile::staticGet('id', $this->profile_id);
  
 +        // TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'.
 +        // TRANS: %1$s is the repeated user's name, %2$s is the repeated notice.
          $content = sprintf(_('RT @%1$s %2$s'),
                             $author->nickname,
                             $this->content);
diff --combined lib/activity.php
index 365bb6258e919d9e2f95d9cae8997f6575649e78,27f09ab4d4639d66f37aef672c9be5fb88e1526e..8e2da99bb3afe46cb559a97178bc9e970178b86d
@@@ -83,6 -83,7 +83,7 @@@ class Activit
      const CREATOR = 'creator';
  
      const CONTENTNS = 'http://purl.org/rss/1.0/modules/content/';
+     const ENCODED = 'encoded';
  
      public $actor;   // an ActivityObject
      public $verb;    // a string (the URL)
          // Insist on a feed's root DOMElement; don't allow a DOMDocument
          if ($feed instanceof DOMDocument) {
              throw new ClientException(
 -                _("Expecting a root feed element but got a whole XML document.")
 +                // TRANS: Client exception thrown when a feed instance is a DOMDocument.
 +                _('Expecting a root feed element but got a whole XML document.')
              );
          }
  
  
          $this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, self::RSS);
  
-         $contentEl = ActivityUtils::child($item, ActivityUtils::CONTENT, self::CONTENTNS);
+         $contentEl = ActivityUtils::child($item, self::ENCODED, self::CONTENTNS);
  
          if (!empty($contentEl)) {
-             $this->content = htmlspecialchars_decode($contentEl->textContent, ENT_QUOTES);
+             // <content:encoded> XML node's text content is HTML; no further processing needed.
+             $this->content = $contentEl->textContent;
          } else {
              $descriptionEl = ActivityUtils::child($item, self::DESCRIPTION, self::RSS);
              if (!empty($descriptionEl)) {
-                 $this->content = htmlspecialchars_decode($descriptionEl->textContent, ENT_QUOTES);
+                 // Per spec, <description> must be plaintext.
+                 // In practice, often there's HTML... but these days good
+                 // feeds are using <content:encoded> which is explicitly
+                 // real HTML.
+                 // We'll treat this following spec, and do HTML escaping
+                 // to convert from plaintext to HTML.
+                 $this->content = htmlspecialchars($descriptionEl->textContent);
              }
          }