summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-29 15:15:51 -0700
committerBrion Vibber <brion@pobox.com>2010-03-29 15:15:51 -0700
commit01a03e34c8d286011c0f4301e60c103d992a449a (patch)
treed9c5a44704b83d3ca05ed1f136a3748fb8210f12 /actions
parente2d3ebb9f4a3b516067745d250b4723367b928c2 (diff)
parentcfeb1bfa419e886a1b60dfcbd4260d2f5de0515b (diff)
Merge branch '0.9.x' into 1.0.x
Diffstat (limited to 'actions')
-rw-r--r--actions/apistatusnetconfig.php4
-rw-r--r--actions/newnotice.php35
2 files changed, 20 insertions, 19 deletions
diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php
index 66b23c02d..76d37ea97 100644
--- a/actions/apistatusnetconfig.php
+++ b/actions/apistatusnetconfig.php
@@ -103,9 +103,9 @@ class ApiStatusnetConfigAction extends ApiAction
$value = common_config($section, $setting);
if (is_array($value)) {
$value = implode(',', $value);
- } else if ($value === false) {
+ } else if ($value === false || $value == '0') {
$value = 'false';
- } else if ($value === true) {
+ } else if ($value === true || $value == '1') {
$value = 'true';
}
diff --git a/actions/newnotice.php b/actions/newnotice.php
index ed0fa1b2b..2aa354870 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,22 +164,25 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $upload = null;
- $upload = MediaFile::fromUpload('attach');
-
- if (isset($upload)) {
-
- $content_shortened .= ' ' . $upload->shortUrl();
-
- if (Notice::contentTooLong($content_shortened)) {
+ $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->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);
@@ -197,12 +200,10 @@ class NewnoticeAction extends Action
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
- if (isset($upload)) {
+ foreach($uploads as $upload) {
$upload->attachToNotice($notice);
}
-
-
if ($this->boolean('ajax')) {
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');