summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-10-28 17:12:22 -0700
committerZach Copley <zach@status.net>2009-10-28 17:13:06 -0700
commite5a2f895a074a6eaaf8184f101503b1520ed780b (patch)
tree31427b7bfc8b7910aeaa1956fb2fa95a0dd82ced /actions
parentb9ce23d0c2c1266b57997bd0d19891aa653d694c (diff)
Rearanged a couple things & removed debugging statements
Diffstat (limited to 'actions')
-rw-r--r--actions/apistatusesupdate.php46
-rw-r--r--actions/newnotice.php26
2 files changed, 29 insertions, 43 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index b7128d084..3a030f0fe 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -112,10 +112,12 @@ class ApiStatusesUpdateAction extends ApiAuthAction
return;
}
- if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) {
- $this->clientError(sprintf(_('The server was unable to handle ' .
- 'that much POST data (%s bytes) due to its current configuration.'),
- $_SERVER['CONTENT_LENGTH']));
+ if (empty($this->status)) {
+ $this->clientError(
+ 'Client must provide a \'status\' parameter with a value.',
+ 400,
+ $this->format
+ );
return;
}
@@ -124,12 +126,10 @@ class ApiStatusesUpdateAction extends ApiAuthAction
return;
}
- if (empty($this->status)) {
- $this->clientError(
- 'Client must provide a \'status\' parameter with a value.',
- 400,
- $this->format
- );
+ // Workaround for PHP returning empty $_FILES when POST length > PHP settings
+
+ if (empty($_POST) && ($_SERVER['CONTENT_LENGTH'] > 0)) {
+ $this->clientError(_('Unable to handle that much POST data!'));
return;
}
@@ -192,27 +192,19 @@ class ApiStatusesUpdateAction extends ApiAuthAction
}
$upload = null;
-
- common_debug('looking for attachment');
-
$upload = MediaFile::fromUpload('media', $this->user);
- common_debug("uploaded file = " . var_export($upload, true));
-
if (isset($upload)) {
- common_debug('newNotice: found an upload');
-
- $status_shortened .= ' ' . $upload->shortUrl();
-
- common_debug('content w/upload = ' . $status_shortened);
+ $status_shortened .= ' ' . $upload->shortUrl();
- if (Notice::contentTooLong($status_shortened)) {
- $upload->delete();
- $this->clientError(sprintf(_('Max notice size is %d chars, including attachment URL.'),
- Notice::maxContent()));
- } else {
- common_debug('content not too long');
- }
+ if (Notice::contentTooLong($status_shortened)) {
+ $upload->delete();
+ $msg = _(
+ 'Max notice size is %d chars, ' .
+ 'including attachment URL.'
+ );
+ $this->clientError(sprintf($msg, Notice::maxContent()));
+ }
}
$this->notice = Notice::saveNew(
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 5100e79e1..59fb9f461 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,27 +164,21 @@ class NewnoticeAction extends Action
}
$upload = null;
-
- common_debug('looking for attachment');
-
$upload = MediaFile::fromUpload('attach');
- common_debug("uploaded file = " . var_export($upload, true));
-
if (isset($upload)) {
- common_debug('newNotice: found an upload');
- $content_shortened .= ' ' . $upload->shortUrl();
+ $content_shortened .= ' ' . $upload->shortUrl();
- common_debug('content w/upload = ' . $content_shortened);
-
- if (Notice::contentTooLong($content_shortened)) {
- $upload->delete();
- $this->clientError(sprintf(_('Max notice size is %d chars, including attachment URL.'),
- Notice::maxContent()));
- } else {
- common_debug('content not too long');
- }
+ if (Notice::contentTooLong($content_shortened)) {
+ $upload->delete();
+ $this->clientError(
+ sprintf(
+ _('Max notice size is %d chars, including attachment URL.'),
+ Notice::maxContent()
+ )
+ );
+ }
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,