X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=482bc550b9d093880d2d181b4355e6b9bfab3549;hb=1b3b7f9a422f6b703ec36d43e2283f91a9835f3b;hp=9ac9e10c109198e88e842561301e67913992454d;hpb=054ac909bf6222254cf9b2c3a4eda824f4f4eb8f;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index 9ac9e10c10..482bc550b9 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -29,6 +29,7 @@ * @author Robin Millette * @author Sarven Capadisli * @author Tom Adams + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license GNU Affero General Public License http://www.gnu.org/licenses/ */ @@ -177,7 +178,8 @@ class Notice extends Memcached_DataObject $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; } @@ -1190,7 +1192,7 @@ class Notice extends Memcached_DataObject 'xmlns:media' => 'http://purl.org/syndication/atommedia', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0', - 'xmlns:statusnet' => 'http://status.net/ont/'); + 'xmlns:statusnet' => 'http://status.net/schema/api/1/'); } else { $attrs = array(); } @@ -1225,7 +1227,7 @@ class Notice extends Memcached_DataObject $xs->element('title', null, common_xml_safe_str($this->content)); if ($author) { - $xs->raw($profile->asAtomAuthor()); + $xs->raw($profile->asAtomAuthor($cur)); $xs->raw($profile->asActivityActor()); } @@ -1238,9 +1240,25 @@ class Notice extends Memcached_DataObject $xs->element('published', null, common_date_w3dtf($this->created)); $xs->element('updated', null, common_date_w3dtf($this->created)); + $source = null; + + $ns = $this->getSource(); + + if ($ns) { + if (!empty($ns->name) && !empty($ns->url)) { + $source = '' + . htmlspecialchars($ns->name) + . ''; + } else { + $source = $ns->code; + } + } + $noticeInfoAttr = array( - 'local_id' => $this->id, // local notice ID (useful to clients for ordering) - 'source' => $this->source, // the client name (source attribution) + 'local_id' => $this->id, // local notice ID (useful to clients for ordering) + 'source' => $source, // the client name (source attribution) ); $ns = $this->getSource(); @@ -1252,8 +1270,8 @@ class Notice extends Memcached_DataObject if (!empty($cur)) { $noticeInfoAttr['favorite'] = ($cur->hasFave($this)) ? "true" : "false"; - $profile = $cur->getProfile(); - $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false"; + $profile = $cur->getProfile(); + $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false"; } if (!empty($this->repeat_of)) { @@ -1557,6 +1575,8 @@ class Notice extends Memcached_DataObject { $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);