summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-03-31 10:57:20 +0200
committerSarven Capadisli <csarven@status.net>2010-03-31 10:57:20 +0200
commit534c12e540f57846af82758678a0e8064ac49f5b (patch)
tree437fc48b24fcf769f231590880a27de25c64229e /actions
parent21a835596c2e11d98ed5b30843e3dad0006fabcc (diff)
Revert "Multiple file upload handling."
This reverts commit 260f00d60bc83ac641d6fbe465e70aec33ccd9be. As mentioned in http://gitorious.org/statusnet/mainline/commit/260f00d60bc83ac641d6fbe465e70aec33ccd9be#comment_8367 Reverting this merge until the bugs are fixed and there is a general agreement on the need for this enhancement.
Diffstat (limited to 'actions')
-rw-r--r--actions/newnotice.php35
1 files changed, 17 insertions, 18 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 2aa354870..ed0fa1b2b 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,25 +164,22 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $uploads = array();
- foreach($_FILES as $name => $value) {
- if(substr($name, 0, 6) == "attach") {
- $upload = MediaFile::fromUpload($name);
- if (isset($upload)) {
- $content_shortened .= ' ' . $upload->shortUrl();
- }
- }
- }
- if (Notice::contentTooLong($content_shortened)) {
- foreach($uploads as $upload) {
+ $upload = null;
+ $upload = MediaFile::fromUpload('attach');
+
+ if (isset($upload)) {
+
+ $content_shortened .= ' ' . $upload->shortUrl();
+
+ if (Notice::contentTooLong($content_shortened)) {
$upload->delete();
+ $this->clientError(
+ sprintf(
+ _('Max notice size is %d chars, including attachment URL.'),
+ Notice::maxContent()
+ )
+ );
}
- $this->clientError(
- sprintf(
- _('Max notice size is %d chars, including attachment URL.'),
- Notice::maxContent()
- )
- );
}
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
@@ -200,10 +197,12 @@ class NewnoticeAction extends Action
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
- foreach($uploads as $upload) {
+ if (isset($upload)) {
$upload->attachToNotice($notice);
}
+
+
if ($this->boolean('ajax')) {
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');