]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote-tracking branch 'upstream/master' into social-master
authorRoland Haeder <roland@mxchange.org>
Mon, 30 Nov 2015 14:27:12 +0000 (15:27 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 30 Nov 2015 14:27:12 +0000 (15:27 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
41 files changed:
1  2 
actions/apimediaupload.php
actions/apistatusesdestroy.php
actions/apistatusesshow.php
actions/apitimelineuser.php
classes/File_redirection.php
classes/Notice.php
classes/User_group.php
lib/action.php
lib/activity.php
lib/attachmentlist.php
lib/default.php
lib/framework.php
lib/imagefile.php
lib/implugin.php
lib/noticelistitem.php
lib/profileaction.php
lib/router.php
lib/search_engines.php
lib/util.php
plugins/Bookmark/BookmarkPlugin.php
plugins/Bookmark/actions/newbookmark.php
plugins/Event/EventPlugin.php
plugins/Event/actions/newevent.php
plugins/Event/classes/Happening.php
plugins/Favorite/classes/Fave.php
plugins/GNUsocialPhotos/actions/editphoto.php
plugins/Linkback/LinkbackPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/actions/ostatusinit.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/magicenvelope.php
plugins/OStatus/lib/salmonaction.php
plugins/OStatus/scripts/resub-feed.php
plugins/OStatus/scripts/testfeed.php
plugins/OStatus/scripts/update-profile-data.php
plugins/OStatus/scripts/update-profile.php
plugins/OStatus/scripts/update_ostatus_profiles.php
plugins/Oembed/classes/File_oembed.php
plugins/Realtime/RealtimePlugin.php
plugins/Xmpp/XmppPlugin.php
scripts/upgrade.php

Simple merge
Simple merge
Simple merge
Simple merge
index 6dda97d0c8b211a7aea90362e4085a6a3b751863,0d90b9e82c0016040e8bf9f3fd83f7653be04d07..6182bb20db2769c045e2a0a46457431f46012222
@@@ -334,9 -332,9 +332,9 @@@ class File_redirection extends Managed_
          return $out_url;
      }
  
 -    static function saveNew($data, $file_id, $url) {
 +    static function saveNew(array $data, $file_id, $url) {
          $file_redir = new File_redirection;
-         $file_redir->urlhash = File::hashurl($short_url);
+         $file_redir->urlhash = File::hashurl($url);
          $file_redir->url = $url;
          $file_redir->file_id = $file_id;
          $file_redir->redirections = intval($data['redirects']);
index 37310af8ef638190df12783aa65bccf52c93b5a9,8f4d63c8927a6a4e7e5809c4ea44a65b6b8bba43..4a7640c891d86cb7ab6bbe807987e2c020b33cef
@@@ -2701,15 -2678,11 +2718,11 @@@ class Notice extends Managed_DataObjec
          return ($result == 1) ? true : false;
      }
  
 -    protected function _inScope($profile)
 +    protected function _inScope(Profile $profile=null)
      {
-         if (!is_null($this->scope)) {
-             $scope = $this->scope;
-         } else {
-             $scope = self::defaultScope();
-         }
+         $scope = is_null($this->scope) ? self::defaultScope() : $this->getScope();
  
-         if ($scope == 0 && !$this->getProfile()->isPrivateStream()) { // Not scoping, so it is public.
+         if ($scope === 0 && !$this->getProfile()->isPrivateStream()) { // Not scoping, so it is public.
              return !$this->isHiddenSpam($profile);
          }
  
Simple merge
diff --cc lib/action.php
Simple merge
Simple merge
Simple merge
diff --cc lib/default.php
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lib/router.php
Simple merge
Simple merge
diff --cc lib/util.php
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index ddd1a2a38dfe145ba881e3f6d94e9ea254edcb8e,4d1c676844c51c5e9736dcc1b043a7525cbc2873..e5908c3650763e5b7b37414b01c22f050807375c
@@@ -529,172 -510,16 +511,16 @@@ class Ostatus_profile extends Managed_D
       * @param Activity $activity
       * @param string $method 'push' or 'salmon'
       * @return mixed saved Notice or false
-      * @todo FIXME: Break up this function, it's getting nasty long
       */
 -    public function processPost($activity, $method)
 +    public function processPost(Activity $activity, $method)
      {
-         $notice = null;
-         $profile = ActivityUtils::checkAuthorship($activity, $this->localProfile());
-         // It's not always an ActivityObject::NOTE, but... let's just say it is.
-         $note = $activity->objects[0];
-         // The id URI will be used as a unique identifier for the notice,
-         // protecting against duplicate saves. It isn't required to be a URL;
-         // tag: URIs for instance are found in Google Buzz feeds.
-         $sourceUri = $note->id;
-         $dupe = Notice::getKV('uri', $sourceUri);
-         if ($dupe instanceof Notice) {
-             common_log(LOG_INFO, "OStatus: ignoring duplicate post: $sourceUri");
-             return $dupe;
-         }
-         // We'll also want to save a web link to the original notice, if provided.
-         $sourceUrl = null;
-         if ($note->link) {
-             $sourceUrl = $note->link;
-         } else if ($activity->link) {
-             $sourceUrl = $activity->link;
-         } else if (preg_match('!^https?://!', $note->id)) {
-             $sourceUrl = $note->id;
-         }
-         // Use summary as fallback for content
+         $actor = ActivityUtils::checkAuthorship($activity, $this->localProfile());
  
-         if (!empty($note->content)) {
-             $sourceContent = $note->content;
-         } else if (!empty($note->summary)) {
-             $sourceContent = $note->summary;
-         } else if (!empty($note->title)) {
-             $sourceContent = $note->title;
-         } else {
-             // @todo FIXME: Fetch from $sourceUrl?
-             // TRANS: Client exception. %s is a source URI.
-             throw new ClientException(sprintf(_m('No content for notice %s.'),$sourceUri));
-         }
-         // Get (safe!) HTML and text versions of the content
-         $rendered = common_purify($sourceContent);
-         $content = common_strip_html($rendered);
-         $shortened = common_shorten_links($content);
-         // If it's too long, try using the summary, and make the
-         // HTML an attachment.
-         $attachment = null;
-         if (Notice::contentTooLong($shortened)) {
-             $attachment = $this->saveHTMLFile($note->title, $rendered);
-             $summary = common_strip_html($note->summary);
-             if (empty($summary)) {
-                 $summary = $content;
-             }
-             $shortSummary = common_shorten_links($summary);
-             if (Notice::contentTooLong($shortSummary)) {
-                 $url = common_shorten_url($sourceUrl);
-                 $shortSummary = substr($shortSummary,
-                                        0,
-                                        Notice::maxContent() - (mb_strlen($url) + 2));
-                 $content = $shortSummary . ' ' . $url;
-                 // We mark up the attachment link specially for the HTML output
-                 // so we can fold-out the full version inline.
-                 // @todo FIXME i18n: This tooltip will be saved with the site's default language
-                 // TRANS: Shown when a notice is longer than supported and/or when attachments are present. At runtime
-                 // TRANS: this will usually be replaced with localised text from StatusNet core messages.
-                 $showMoreText = _m('Show more');
-                 $attachUrl = common_local_url('attachment',
-                                               array('attachment' => $attachment->id));
-                 $rendered = common_render_text($shortSummary) .
-                             '<a href="' . htmlspecialchars($attachUrl) .'"'.
-                             ' class="attachment more"' .
-                             ' title="'. htmlspecialchars($showMoreText) . '">' .
-                             '&#8230;' .
-                             '</a>';
-             }
-         }
-         $options = array('is_local' => Notice::REMOTE,
-                         'url' => $sourceUrl,
-                         'uri' => $sourceUri,
-                         'rendered' => $rendered,
-                         'replies' => array(),
-                         'groups' => array(),
-                         'peopletags' => array(),
-                         'tags' => array(),
-                         'urls' => array());
-         // Check for optional attributes...
-         if (!empty($activity->time)) {
-             $options['created'] = common_sql_date($activity->time);
-         }
-         if ($activity->context) {
-             // TODO: context->attention
-             list($options['groups'], $options['replies'])
-                 = self::filterAttention($profile, $activity->context->attention);
-             // Maintain direct reply associations
-             // @todo FIXME: What about conversation ID?
-             if (!empty($activity->context->replyToID)) {
-                 $orig = Notice::getKV('uri', $activity->context->replyToID);
-                 if ($orig instanceof Notice) {
-                     $options['reply_to'] = $orig->id;
-                 }
-             }
-             if (!empty($activity->context->conversation)) {
-                 // we store the URI here, Notice class can look it up later
-                 $options['conversation'] = $activity->context->conversation;
-             }
-             $location = $activity->context->location;
-             if ($location) {
-                 $options['lat'] = $location->lat;
-                 $options['lon'] = $location->lon;
-                 if ($location->location_id) {
-                     $options['location_ns'] = $location->location_ns;
-                     $options['location_id'] = $location->location_id;
-                 }
-             }
-         }
-         if ($this->isPeopletag()) {
-             $options['peopletags'][] = $this->localPeopletag();
-         }
-         // Atom categories <-> hashtags
-         foreach ($activity->categories as $cat) {
-             if ($cat->term) {
-                 $term = common_canonical_tag($cat->term);
-                 if ($term) {
-                     $options['tags'][] = $term;
-                 }
-             }
-         }
-         // Atom enclosures -> attachment URLs
-         foreach ($activity->enclosures as $href) {
-             // @todo FIXME: Save these locally or....?
-             $options['urls'][] = $href;
-         }
+         $options = array('is_local' => Notice::REMOTE);
  
          try {
-             $saved = Notice::saveNew($profile->id,
-                                      $content,
-                                      'ostatus',
-                                      $options);
-             if ($saved instanceof Notice) {
-                 Ostatus_source::saveNew($saved, $this, $method);
-                 if ($attachment instanceof File) {
-                     File_to_post::processNew($attachment, $saved);
-                 }
-             }
+             $stored = Notice::saveActivity($activity, $actor, $options);
+             Ostatus_source::saveNew($stored, $this, $method);
          } catch (Exception $e) {
              common_log(LOG_ERR, "OStatus save of remote message $sourceUri failed: " . $e->getMessage());
              throw $e;
Simple merge
Simple merge
index edf64cd5f6247c047dbe01c5c95bef1caab103a9,d5d0924fbfe3fe7330df4f49f543c20d175a8368..efad67dbb5005f1894b2289341992c1708134a60
@@@ -34,9 -34,11 +34,11 @@@ Options
  
  END_OF_HELP;
  
 -require_once INSTALLDIR.'/scripts/commandline.inc';
 +require_once INSTALLDIR.'/scripts/commandline.inc.php';
  
- if (empty($args[0]) || !Validate::uri($args[0])) {
+ $validate = new Validate();
+ if (empty($args[0]) || !$validate->uri($args[0])) {
      print "$helptext";
      exit(1);
  }
index e22f22ac501abe91143dceac0141ed2cdfacfae5,da1eee292ef8d5a3b439a7d0bb039ad167b39c4e..2a12069b5f5eeee7962d8b1014d42a42da9988e6
@@@ -33,9 -33,11 +33,11 @@@ Mainly intended for testing funky feed 
  
  END_OF_HELP;
  
 -require_once INSTALLDIR.'/scripts/commandline.inc';
 +require_once INSTALLDIR.'/scripts/commandline.inc.php';
  
- if (empty($args[0]) || !Validate::uri($args[0])) {
+ $validate = new Validate();
+ if (empty($args[0]) || !$validate->uri($args[0])) {
      print "$helptext";
      exit(1);
  }
index 20073e0750ce2d92bc8195640023ad03689db3a1,c5d9aa897c264549dac9a07a0da7c14d72a53699..40adda102ef8a6128c6403445abbd0f49459eed4
@@@ -30,9 -30,11 +30,11 @@@ things restarted if the hub or feed URL
  
  END_OF_HELP;
  
 -require_once INSTALLDIR.'/scripts/commandline.inc';
 +require_once INSTALLDIR.'/scripts/commandline.inc.php';
  
- if (empty($args[0]) || !Validate::uri($args[0])) {
+ $validate = new Validate();
+ if (empty($args[0]) || !$validate->uri($args[0])) {
      print "$helptext";
      exit(1);
  }
Simple merge
Simple merge
Simple merge