]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote-tracking branch 'upstream/master' into social-master
authorRoland Haeder <roland@mxchange.org>
Thu, 11 Feb 2016 13:31:04 +0000 (14:31 +0100)
committerRoland Haeder <roland@mxchange.org>
Thu, 11 Feb 2016 13:31:04 +0000 (14:31 +0100)
There was an unneccessary cast to array which you don't need if you set it in
the method's signature.

Signed-off-by: Roland Haeder <roland@mxchange.org>
50 files changed:
1  2 
actions/apimediaupload.php
actions/apistatusesshow.php
actions/backupaccount.php
actions/register.php
actions/shownotice.php
classes/Avatar.php
classes/File.php
classes/File_redirection.php
classes/File_thumbnail.php
classes/Notice.php
index.php
lib/action.php
lib/activityutils.php
lib/attachmentlistitem.php
lib/default.php
lib/framework.php
lib/httpclient.php
lib/imagefile.php
lib/infoaction.php
lib/installer.php
lib/router.php
lib/urlmapper.php
lib/util.php
plugins/Bookmark/BookmarkPlugin.php
plugins/Event/EventPlugin.php
plugins/FacebookBridge/FacebookBridgePlugin.php
plugins/Favorite/classes/Fave.php
plugins/Linkback/LinkbackPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/classes/FeedSub.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/huboutqueuehandler.php
plugins/OStatus/lib/magicenvelope.php
plugins/OStatus/lib/ostatusqueuehandler.php
plugins/OStatus/lib/salmonaction.php
plugins/OStatus/scripts/resub-feed.php
plugins/OStatus/scripts/update-profile-data.php
plugins/OStatus/scripts/update_ostatus_profiles.php
plugins/OStatus/tests/slap.php
plugins/Oembed/actions/oembed.php
plugins/OpenID/OpenIDPlugin.php
plugins/OpportunisticQM/OpportunisticQMPlugin.php
plugins/OpportunisticQM/lib/opportunisticqueuemanager.php
plugins/Share/SharePlugin.php
plugins/StrictTransportSecurity/StrictTransportSecurityPlugin.php
plugins/TwitterBridge/TwitterBridgePlugin.php
scripts/handlequeued.php
scripts/importtwitteratom.php
scripts/upgrade.php
scripts/userrole.php

index 86742e07bd063363a69d400567f8b95e7b2d52ba,38b3a6f4feae569363fbc9d0d67b3e11d86b505f..0be9a188d65ebf17b868b9a5e4f6c7481c4a0ff6
@@@ -42,17 -42,23 +42,23 @@@ class ApiMediaUploadAction extends ApiA
  {
      protected $needPost = true;
  
-     /**
-      * Handle the request
-      *
-      * Grab the file from the 'media' param, then store, and shorten
-      *
-      * @todo Upload throttle!
-      * @return void
-      */
+     protected function prepare(array $args=array())
+     {
+         parent::prepare($args);
+         // fallback to xml for older clients etc
+         if (empty($this->format)) {
+             $this->format = 'xml';
+         }
+         if (!in_array($this->format, ['json', 'xml'])) {
+             throw new ClientException('This API call does not support the format '._ve($this->format));
+         }
+         return true;
+     }
      protected function handle()
      {
 -        parent::handle();
 +        parent::handle($args);
  
          // Workaround for PHP returning empty $_POST and $_FILES when POST
          // length > post_max_size in php.ini
Simple merge
index 4d7b6fcfcd653f4ed2b5f0d978b3ed83ffb5e9f4,7f37f3b8519370c414959bd7867c6fbd26613257..15bb4df8b75599d7011c43f6eab8500314453979
@@@ -128,29 -76,7 +76,7 @@@ class BackupaccountAction extends FormA
          $this->raw($stream->getString());
      }
  
-     /**
-      * Show a little form so that the person can request a backup.
-      *
-      * @return void
-      */
-     function showContent()
-     {
-         $form = new BackupAccountForm($this);
-         $form->show();
-     }
-     /**
-      * Return true if read only.
-      *
-      * MAY override
-      *
-      * @param array $args other arguments
-      *
-      * @return boolean is read only action?
-      */
-     function isReadOnly(array $args=array())
-     {
 -    public function isReadOnly($args) {
++    public function isReadOnly(array $args=array()) {
          return true;
      }
  
Simple merge
Simple merge
Simple merge
index 735655489b6908d821f6ec3988910705f970ca3c,6ba80eb5f66ad976e9269dac32e6235a8ff5f4ed..dbd9a3bb449f71ae79baf79198c7fa8029eea0d2
@@@ -423,10 -428,8 +428,11 @@@ class File extends Managed_DataObjec
              }
          }
  
-         /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop));
 +        // Debug log (convert crop to int to have TRUE being displayed as 1 and FALSE as 0)
-         return $image->getFileThumbnail($width, $height, $crop);
++        /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop) . ',upscale=' . intval($upscale));
 +
+         return $image->getFileThumbnail($width, $height, $crop,
+                                         !is_null($upscale) ? $upscale : common_config('thumbnail', 'upscale'));
      }
  
      public function getPath()
Simple merge
Simple merge
Simple merge
diff --cc index.php
Simple merge
diff --cc lib/action.php
Simple merge
index 76e4777deb5feb471dc69960ff1c1feee64c00f4,b86dd6590928501db8080a819f73037666f4b68c..7376ff584b80ecb08631732f1064d403b8caa82d
@@@ -348,18 -348,18 +348,20 @@@ class ActivityUtil
          return null;
      }
  
 -    static function compareTypes($type, $objects)
 +    static function compareTypes($type, array $objects)
      {
-         $type = self::resolveUri($type);
+         $type = self::resolveUri($type, false);
 -        foreach ((array)$objects as $object) {
++
 +        foreach ($objects as $object) {
              if ($type === self::resolveUri($object)) {
                  return true;
              }
          }
++
          return false;
      }
  
--    static function compareVerbs($type, $objects)
++    static function compareVerbs($type, array $objects)
      {
          return self::compareTypes($type, $objects);
      }
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
index 322b8821ae767588fd8c595212958c6a5bcd7191,6a5c310193287b44edface3820b94a0100d2fdcf..23a169d006333171da5bef629cf1dcb8fdf924dd
@@@ -1284,35 -1361,11 +1361,11 @@@ function common_local_url($action, $arg
      return $url;
  }
  
- function common_is_sensitive($action)
- {
-     static $sensitive = array(
-         'login',
-         'register',
-         'passwordsettings',
-         'api',
-         'ApiOAuthRequestToken',
-         'ApiOAuthAccessToken',
-         'ApiOAuthAuthorize',
-         'ApiOAuthPin',
-         'showapplication'
-     );
-     $ssl = null;
-     if (Event::handle('SensitiveAction', array($action, &$ssl))) {
-         $ssl = in_array($action, $sensitive);
-     }
-     return $ssl;
- }
  function common_path($relative, $ssl=false, $addSession=true)
  {
 -    $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
 +    $pathpart = (!empty(common_config('site', 'path'))) ? common_config('site', 'path') . '/' : '';
  
-     if (($ssl && (common_config('site', 'ssl') === 'sometimes'))
-         || GNUsocial::isHTTPS()
-         || common_config('site', 'ssl') === 'always') {
+     if ($ssl && GNUsocial::useHTTPS()) {
          $proto = 'https';
          if (is_string(common_config('site', 'sslserver')) &&
              mb_strlen(common_config('site', 'sslserver')) > 0) {
@@@ -2455,34 -2514,7 +2514,39 @@@ function html_sprintf(
      return call_user_func_array('sprintf', $args);
  }
  
 +function common_location_shared()
 +{
 +    // Get default setting
 +    $cfg = common_config('location', 'share');
 +
 +    if ($cfg == 'always') {
 +        // Always enabled
 +        return true;
 +    } elseif ($cfg == 'never') {
 +        // Never enabled
 +        return false;
 +    }
 +
 +    // Is the user logged-in?
 +    if (common_logged_in()) {
 +        // Get current user
 +        $user = common_current_user();
 +
 +        // Is it there?
 +        if ($user instanceof User) {
 +            // Yes, get profile
 +            $profile = $user->getProfile();
 +
 +            // Get it from the profile
 +            return $profile->shareLocation();
 +        }
 +    }
 +
 +    // User is not logged in, get default
 +    return common_config('location', 'sharedefault');
 +}
++
+ function _ve($var)
+ {
+     return var_export($var, true);
+ }
Simple merge
index a7d984fd836011052b6ea7a006cff12648f26df9,82ba2c19cb96d580abf770f52f2d1ddb1128bdfa..5d3f723c38b3b5d391f0288be5fee2757885f84d
@@@ -364,9 -262,8 +262,8 @@@ class EventPlugin extends ActivityVerbH
          return true;
      }
  
 -    function onStartAddNoticeReply($nli, $parent, $child)
 +    function onStartAddNoticeReply(NoticeListItem $nli, Notice $parent, Notice $child)
      {
-         // Filter out any poll responses
          if (($parent->object_type == Happening::OBJECT_TYPE) &&
              in_array($child->object_type, array(RSVP::POSITIVE, RSVP::NEGATIVE, RSVP::POSSIBLE))) {
              return false;
Simple merge
Simple merge
Simple merge
Simple merge
index a057da515bdd84529361d29d063f71a9a3f0c7a1,35171895abfb183199f2395b66fa621baa7940e5..39a07d63c550d0f3b0ef338e55084644992645c8
@@@ -340,19 -340,19 +340,19 @@@ class MagicEnvelop
      public function verify(Profile $profile)
      {
          if ($this->alg != 'RSA-SHA256') {
-             common_debug("Salmon error: bad algorithm");
 -            common_log(LOG_DEBUG, 'Salmon error: bad algorithm: '._ve($this->alg));
++            common_debug('Salmon error: bad algorithm: ' . _ve($this->alg));
              return false;
          }
  
          if ($this->encoding != self::ENCODING) {
-             common_debug("Salmon error: bad encoding");
 -            common_log(LOG_DEBUG, 'Salmon error: bad encoding: '._ve($this->encoding));
++            common_debug('Salmon error: bad encoding: ' . _ve($this->encoding));
              return false;
          }
  
          try {
              $magicsig = $this->getKeyPair($profile, true);    // Do discovery too if necessary
          } catch (Exception $e) {
-             common_debug("Salmon error: ".$e->getMessage());
 -            common_log(LOG_DEBUG, "Salmon error: getKeyPair for profile id=={$profile->getID()}: "._ve($e->getMessage()));
++            common_debug("Salmon error: getKeyPair for profile id=={$profile->getID()}: " . _ve($e->getMessage()));
              return false;
          }
  
index 2f48042820ba9add9c411afd7e761eac64a2ebeb,41e4262498340d4cd13d03853dc9e8680b04aa55..ef6099c883886bb692a2b01aab34ef8bb1ba80c8
@@@ -93,7 -94,26 +94,26 @@@ class SalmonAction extends Actio
      {
          parent::handle();
  
-         common_debug("Got a " . $this->activity->verb);
+         assert($this->activity instanceof Activity);
+         assert($this->target instanceof Profile);
 -        common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
++        common_debug('Got a ' . $this->activity->verb);
+         try {
+             $options = [ 'source' => 'ostatus' ];
+             common_debug('Save salmon slap directly with Notice::saveActivity for actor=='.$this->actor->getID());
+             $stored = Notice::saveActivity($this->activity, $this->actor, $options);
+             common_debug('Save salmon slap finished, notice id=='.$stored->getID());
+             return true;
+         } catch (AlreadyFulfilledException $e) {
+             // The action's results are already fulfilled. Maybe it was a
+             // duplicate? Maybe someone's database is out of sync?
+             // Let's just accept it and move on.
+             common_log(LOG_INFO, 'Salmon slap carried an event which had already been fulfilled.');
+             return true;
+         } catch (NoticeSaveException $e) {
+             common_debug('Notice::saveActivity did not save our '._ve($this->activity->verb).' activity, trying old-fashioned salmon saving.');
+         }
          try {
              if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) &&
                      Event::handle('StartHandleSalmon', array($this->activity))) {
Simple merge
Simple merge
Simple merge
index fdd484caefff0b5264c24940cb65b79ca9eb3bf9,8e0486105f90f202e288cf81528b1a3b896c0b22..89d79e9b0d9ca5a06d4e5194831c47454f4e05a3
@@@ -30,8 -4,9 +30,9 @@@ class OpportunisticQMPlugin extends Plu
      public $qmkey = false;
      public $secs_per_action = 1; // total seconds to run script per action
      public $rel_to_pageload = true;  // relative to pageload or queue start
+     public $verbosity = 1;
  
 -    public function onRouterInitialized($m)
 +    public function onRouterInitialized(URLMapper $m)
      {
          $m->connect('main/runqueue', array('action' => 'runqueue'));
      }
Simple merge
index 3d7788c71163b37eab5ce33071cd9fe5219bac36,67cb66501801f5a7dca45cbf2978662163897a8f..ca7434a7fbcbcc558672540cddb1364c66bfd334
@@@ -40,10 -40,10 +40,10 @@@ class StrictTransportSecurityPlugin ext
          parent::__construct();
      }
  
 -    function onArgsInitialize($args)
 +    function onArgsInitialize(array &$args)
      {
          $path = common_config('site', 'path');
-         if(common_config('site', 'ssl') == 'always' && ($path == '/' || ! $path )) {
+         if (GNUsocial::useHTTPS() && ($path == '/' || mb_strlen($path)==0 )) {
              header('Strict-Transport-Security: max-age=' . $this->max_age
                      . ($this->includeSubDomains ? '; includeSubDomains' : '')
                      . ($this->preloadToken ? '; preload' : ''));
Simple merge
Simple merge
Simple merge
Simple merge