Merged stuff from upstream/master
authorRoland Haeder <roland@mxchange.org>
Sat, 30 Jan 2016 12:38:25 +0000 (13:38 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 30 Jan 2016 12:38:25 +0000 (13:38 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
15 files changed:
actions/apiaccountverifycredentials.php
actions/apimediaupload.php
actions/replies.php
classes/File.php
classes/File_redirection.php
classes/Notice.php
lib/router.php
plugins/Blacklist/BlacklistPlugin.php
plugins/Bookmark/classes/Bookmark.php
plugins/Event/classes/RSVP.php
plugins/ForceGroup/ForceGroupPlugin.php
plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/salmonaction.php
plugins/TwitterBridge/actions/twitterauthorization.php

index 12daf3e1e6fe68150ea652154ee420bf32bf0ba8..f82060f54730d61c7ea6698256b7ea1573bebf0b 100644 (file)
@@ -57,7 +57,7 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
      */
     protected function handle()
     {
      */
     protected function handle()
     {
-        parent::handle();
+        parent::handle($args);
 
         if (!in_array($this->format, array('xml', 'json'))) {
             // TRANS: Client error displayed when coming across a non-supported API method.
 
         if (!in_array($this->format, array('xml', 'json'))) {
             // TRANS: Client error displayed when coming across a non-supported API method.
index c2b4a47b9a277d799acd799d5d1e2c4a597f22fb..86742e07bd063363a69d400567f8b95e7b2d52ba 100644 (file)
@@ -52,7 +52,7 @@ class ApiMediaUploadAction extends ApiAuthAction
      */
     protected function handle()
     {
      */
     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
 
         // Workaround for PHP returning empty $_POST and $_FILES when POST
         // length > post_max_size in php.ini
index efe0d62beb9b59337b9f9df0f8978b24e9ce6434..de6c0dac43fc1aa032f61c110ceb473080705291 100644 (file)
@@ -152,7 +152,7 @@ class RepliesAction extends ShowstreamAction
         $this->elementEnd('div');
     }
 
         $this->elementEnd('div');
     }
 
-    public function isReadOnly(array $args = array())
+    public function isReadOnly(array $args=array())
     {
         return true;
     }
     {
         return true;
     }
index 2390f848de28f420abb06dd211c237ea32467406..735655489b6908d821f6ec3988910705f970ca3c 100644 (file)
@@ -423,6 +423,9 @@ class File extends Managed_DataObject
             }
         }
 
             }
         }
 
+        // Debug log (convert crop to int to have TRUE being displayed as 1 and FALSE as 0)
+        /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop));
+
         return $image->getFileThumbnail($width, $height, $crop);
     }
 
         return $image->getFileThumbnail($width, $height, $crop);
     }
 
index 4afb6d449a834eb4a647126136acc163acb4fcc0..1cbf6796c02366d0870703131f888802740d4724 100644 (file)
@@ -397,4 +397,4 @@ class File_redirection extends Managed_DataObject
 
         return $this->file;
     }
 
         return $this->file;
     }
-}
\ No newline at end of file
+}
index 53832def80a8cb3f88587dc70488958eb2896d7a..2d3ed9942a4950c253c49829c9097d602f4cb57d 100644 (file)
@@ -3121,5 +3121,15 @@ class Notice extends Managed_DataObject
             print ".";
         }
         print "\n";
             print ".";
         }
         print "\n";
+
+    /**
+     * Checks whether this notice is in "private scope" (non-public notice)
+     *
+     * @return $isPrivate Whether this notice is private
+     */
+    public function isPrivateScope ()
+    {
+        return ($this->scope != Notice::SITE_SCOPE &&
+                $this->scope != Notice::PUBLIC_SCOPE);
     }
 }
     }
 }
index 1bbcd820a783cbafcbf75eb23b56130a9daa1817..bf8cb2b833693db463d0e7f8b442c08a746fd797 100644 (file)
@@ -182,7 +182,7 @@ class Router
 
             foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
                            'oauthapps', 'email', 'sms', 'url') as $s) {
 
             foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
                            'oauthapps', 'email', 'sms', 'url') as $s) {
-                $m->connect('settings/'.$s, array('action' => $s.'settings'));
+                $m->connect('settings/' . $s, array('action' => $s . 'settings'));
             }
 
             if (common_config('oldschool', 'enabled')) {
             }
 
             if (common_config('oldschool', 'enabled')) {
index 1780f42e62736fdaedba9982513999251f10df8c..d1ee2912afa8f1b965cc53cb0656cd60fbe34628 100644 (file)
@@ -433,17 +433,17 @@ class BlacklistPlugin extends Plugin
         return $hostname;
     }
 
         return $hostname;
     }
 
-    function onStartHandleFeedEntry($activity)
+    function onStartHandleFeedEntry(Activity $activity)
     {
         return $this->_checkActivity($activity);
     }
 
     {
         return $this->_checkActivity($activity);
     }
 
-    function onStartHandleSalmon($activity)
+    function onStartHandleSalmon(Activity $activity)
     {
         return $this->_checkActivity($activity);
     }
 
     {
         return $this->_checkActivity($activity);
     }
 
-    function _checkActivity($activity)
+    function _checkActivity(Activity $activity)
     {
         $actor = $activity->actor;
 
     {
         $actor = $activity->actor;
 
index b593bc1909cef57d26f34d70656fe133fbe82a1e..7fd3f53ac1546ea008dcde34bd8b4bfc0256fdc7 100644 (file)
@@ -92,12 +92,16 @@ class Bookmark extends Managed_DataObject
      * @return  Bookmark            The found bookmark object.
      * @throws  NoResultException   When you don't find it after all.
      */
      * @return  Bookmark            The found bookmark object.
      * @throws  NoResultException   When you don't find it after all.
      */
+<<<<<<< .merge_file_ZPs3Af
     static public function fromStored(Notice $stored)
     {
         return self::getByPK(array('uri' => $stored->getUri()));
     }
 
     public function getStored()
     static public function fromStored(Notice $stored)
     {
         return self::getByPK(array('uri' => $stored->getUri()));
     }
 
     public function getStored()
+=======
+    static function getByNotice(Notice $notice)
+>>>>>>> .merge_file_eD7Wwf
     {
         return Notice::getByKeys(array('uri' => $this->getUri()));
     }
     {
         return Notice::getByKeys(array('uri' => $this->getUri()));
     }
@@ -157,7 +161,12 @@ class Bookmark extends Managed_DataObject
      *
      * @return Bookmark the Bookmark object
      */
      *
      * @return Bookmark the Bookmark object
      */
+<<<<<<< .merge_file_ZPs3Af
     static function saveActivityObject(ActivityObject $actobj, Notice $stored)
     static function saveActivityObject(ActivityObject $actobj, Notice $stored)
+=======
+    static function saveNew(Profile $profile, $title, $url, $rawtags, $description,
+                            array $options=array())
+>>>>>>> .merge_file_eD7Wwf
     {
         $url = null;
         // each extra element is array('tagname', array('attr'=>'val', ...), 'content')
     {
         $url = null;
         // each extra element is array('tagname', array('attr'=>'val', ...), 'content')
@@ -177,11 +186,20 @@ class Bookmark extends Managed_DataObject
             throw new ClientException(sprintf(_m('Expected exactly 1 link rel=related in a Bookmark, got %1$d.'), count($relLinkEls)));
         }
 
             throw new ClientException(sprintf(_m('Expected exactly 1 link rel=related in a Bookmark, got %1$d.'), count($relLinkEls)));
         }
 
+<<<<<<< .merge_file_ZPs3Af
         if (!strlen($actobj->title)) {
             throw new ClientException(_m('You must provide a non-empty title.'));
         }
         if (!common_valid_http_url($url)) {
             throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).'));
         if (!strlen($actobj->title)) {
             throw new ClientException(_m('You must provide a non-empty title.'));
         }
         if (!common_valid_http_url($url)) {
             throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).'));
+=======
+        if (array_key_exists('uri', $options)) {
+            $other = Bookmark::getKV('uri', $options['uri']);
+            if (!empty($other)) {
+                // TRANS: Client exception thrown when trying to save a new bookmark that already exists.
+                throw new ClientException(_m('Bookmark already exists.'));
+            }
+>>>>>>> .merge_file_eD7Wwf
         }
 
         try {
         }
 
         try {
index f6b8c0aa7c847a2a28509132f8a6d9ebe8209df0..7fa76d7151a390addf0ad6e41f170c3ce2793331 100644 (file)
@@ -91,7 +91,11 @@ class RSVP extends Managed_DataObject
         );
     }
 
         );
     }
 
+<<<<<<< .merge_file_oq2F7C
     static public function beforeSchemaUpdate()
     static public function beforeSchemaUpdate()
+=======
+    function saveNew(Profile $profile, $event, $verb, array $options = array())
+>>>>>>> .merge_file_L3oA6C
     {
         $table = strtolower(get_called_class());
         $schema = Schema::get();
     {
         $table = strtolower(get_called_class());
         $schema = Schema::get();
index 56e33355e86703ecc5d356ccf911d46a07704141..a27436e6fa6c6c848908cfa51ec05b6977d6c4dd 100644 (file)
@@ -49,7 +49,7 @@ class ForceGroupPlugin extends Plugin
      * @param Notice $notice
      * @return boolean event hook return
      */
      * @param Notice $notice
      * @return boolean event hook return
      */
-    function onStartNoticeDistribute($notice)
+    function onStartNoticeDistribute(Notice $notice)
     {
         $profile = $notice->getProfile();
 
     {
         $profile = $notice->getProfile();
 
index 906509fef5d52573b1b07c53810bc7465ef0efde..5e0f3f780efb27a3f02dfabee5beb1d9c440ace6 100644 (file)
@@ -54,7 +54,7 @@ class GNUsocialPhotosPlugin extends Plugin
         return true;
     }
 
         return true;
     }
 
-    function onStartNoticeDistribute($notice)
+    function onStartNoticeDistribute(Notice $notice)
     {
         common_log(LOG_INFO, "event: StartNoticeDistribute");
         if (GNUsocialPhotoTemp::$tmp) {
     {
         common_log(LOG_INFO, "event: StartNoticeDistribute");
         if (GNUsocialPhotoTemp::$tmp) {
@@ -84,7 +84,7 @@ class GNUsocialPhotosPlugin extends Plugin
     }
 
 
     }
 
 
-    function onStartHandleFeedEntry($activity)
+    function onStartHandleFeedEntry(Activity $activity)
     {
         common_log(LOG_INFO, 'photo plugin: onEndAtomPubNewActivity');
         $oprofile = Ostatus_profile::ensureActorProfile($activity);
     {
         common_log(LOG_INFO, 'photo plugin: onEndAtomPubNewActivity');
         $oprofile = Ostatus_profile::ensureActorProfile($activity);
@@ -121,7 +121,7 @@ class GNUsocialPhotosPlugin extends Plugin
         return true;
     }
 
         return true;
     }
 
-    function onStartShowNoticeItem($action)
+    function onStartShowNoticeItem(Action $action)
     {
         $photo = GNUsocialPhoto::getKV('notice_id', $action->notice->id);
         if($photo) { 
     {
         $photo = GNUsocialPhoto::getKV('notice_id', $action->notice->id);
         if($photo) { 
index 07432d78fa1c4d65a3134973bcc948ec7a84e38c..b4df92e2daeb8b092dd5bdf4c71cdd869d7e4b40 100644 (file)
@@ -894,10 +894,12 @@ class Ostatus_profile extends Managed_DataObject
         $temp_filename = tempnam(common_get_temp_dir(), 'listener_avatar');
         try {
             $imgData = HTTPClient::quickGet($url);
         $temp_filename = tempnam(common_get_temp_dir(), 'listener_avatar');
         try {
             $imgData = HTTPClient::quickGet($url);
+
             // Make sure it's at least an image file. ImageFile can do the rest.
             if (false === getimagesizefromstring($imgData)) {
                 throw new UnsupportedMediaException(_('Downloaded group avatar was not an image.'));
             }
             // Make sure it's at least an image file. ImageFile can do the rest.
             if (false === getimagesizefromstring($imgData)) {
                 throw new UnsupportedMediaException(_('Downloaded group avatar was not an image.'));
             }
+
             file_put_contents($temp_filename, $imgData);
             unset($imgData);    // No need to carry this in memory.
 
             file_put_contents($temp_filename, $imgData);
             unset($imgData);    // No need to carry this in memory.
 
index 2f48042820ba9add9c411afd7e761eac64a2ebeb..f328f0916a2a6d520dc7fd6f7caa26e092472ab0 100644 (file)
@@ -79,8 +79,17 @@ class SalmonAction extends Action
             $this->clientError($e->getMessage());
         }
 
             $this->clientError($e->getMessage());
         }
 
+<<<<<<< .merge_file_l1W8if
         // Cryptographic verification test, throws exception on failure
         $magic_env->verify($this->actor);
         // Cryptographic verification test, throws exception on failure
         $magic_env->verify($this->actor);
+=======
+        // Cryptographic verification test
+        if (!$magic_env->verify($this->actor)) {
+            common_debug("Salmon signature verification failed.");
+            // TRANS: Client error.
+            $this->clientError(_m('Salmon signature verification failed.'));
+        }
+>>>>>>> .merge_file_ISiK5f
 
         return true;
     }
 
         return true;
     }
index c9b892b6408d74ec5b388cf0333704c92699dfae..d3df46bfefc68ed5246683cc60f62c7858f3a15c 100644 (file)
@@ -56,17 +56,50 @@ class TwitterauthorizationAction extends FormAction
     var $access_token = null;
     var $verifier     = null;
 
     var $access_token = null;
     var $verifier     = null;
 
+<<<<<<< .merge_file_Bq71r4
     protected $needLogin = false;   // authorization page can also be used to create a new user
     protected $needLogin = false;   // authorization page can also be used to create a new user
+=======
+    /**
+     * Initialize class members. Looks for 'oauth_token' parameter.
+     *
+     * @param array $args misc. arguments
+     *
+     * @return boolean true
+     */
+    function prepare(array $args=array())
+    {
+        parent::prepare($args);
+>>>>>>> .merge_file_Ad5nH4
 
     protected function doPreparation()
     {
         $this->oauth_token = $this->arg('oauth_token');
         $this->verifier    = $this->arg('oauth_verifier');
 
 
     protected function doPreparation()
     {
         $this->oauth_token = $this->arg('oauth_token');
         $this->verifier    = $this->arg('oauth_verifier');
 
+<<<<<<< .merge_file_Bq71r4
         if ($this->scoped instanceof Profile) {
             try {
                 $flink = Foreign_link::getByUserID($this->scoped->getID(), TWITTER_SERVICE);
                 $fuser = $flink->getForeignUser();
         if ($this->scoped instanceof Profile) {
             try {
                 $flink = Foreign_link::getByUserID($this->scoped->getID(), TWITTER_SERVICE);
                 $fuser = $flink->getForeignUser();
+=======
+        return true;
+    }
+
+    /**
+     * Handler method
+     *
+     * @param array $args is ignored since it's now passed in in prepare()
+     *
+     * @return nothing
+     */
+    function handle(array $args=array())
+    {
+        parent::handle($args);
+
+        if (common_logged_in()) {
+            $user  = common_current_user();
+            $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
+>>>>>>> .merge_file_Ad5nH4
 
                 // If there's already a foreign link record and a foreign user
                 // (no exceptions were thrown when fetching either of them...)
 
                 // If there's already a foreign link record and a foreign user
                 // (no exceptions were thrown when fetching either of them...)