]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apimediaupload.php
Some files got updated coding style
[quix0rs-gnu-social.git] / actions / apimediaupload.php
index 0b08dbedf1bc1dec517b0e8e26307ca1e9e4d280..6f8781fab5b57b86b8bfd0e30485ae18b414cece 100644 (file)
@@ -30,9 +30,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/apiauth.php';
-require_once INSTALLDIR . '/lib/mediafile.php';
-
 /**
  * Upload an image via the API.  Returns a shortened URL for the image
  * to the user.
@@ -66,7 +63,6 @@ class ApiMediaUploadAction extends ApiAuthAction
                 _('This method requires a POST.'),
                 400, $this->format
             );
-            return;
         }
 
         // Workaround for PHP returning empty $_POST and $_FILES when POST
@@ -82,16 +78,14 @@ class ApiMediaUploadAction extends ApiAuthAction
                       'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
                       intval($_SERVER['CONTENT_LENGTH']));
             $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
-            return;
         }
 
         $upload = null;
 
         try {
-            $upload = MediaFile::fromUpload('media', $this->auth_user);
+            $upload = MediaFile::fromUpload('media', $this->auth_user->getProfile());
         } catch (Exception $e) {
             $this->clientError($e->getMessage(), $e->getCode());
-            return;
         }
 
         if (isset($upload)) {
@@ -99,7 +93,6 @@ class ApiMediaUploadAction extends ApiAuthAction
         } else {
             // TRANS: Client error displayed when uploading a media file has failed.
             $this->clientError(_('Upload failed.'));
-            return;
         }
     }