summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/newmessage.php13
-rw-r--r--actions/newnotice.php13
-rw-r--r--actions/postnotice.php7
-rw-r--r--actions/profilesettings.php4
-rw-r--r--actions/twitapidirect_messages.php9
-rw-r--r--actions/twitapistatuses.php18
6 files changed, 43 insertions, 21 deletions
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 7dce97d20..2455f42e9 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -53,10 +53,15 @@ class NewmessageAction extends Action {
$this->show_form(_('No content!'));
return;
} else if (mb_strlen($content) > 140) {
- common_debug("Content = '$content'", __FILE__);
- common_debug("mb_strlen(\$content) = " . mb_strlen($content), __FILE__);
- $this->show_form(_('That\'s too long. Max message size is 140 chars.'));
- return;
+
+ $content = common_shorten_links($content);
+
+ if (mb_strlen($content) > 140) {
+ common_debug("Content = '$content'", __FILE__);
+ common_debug("mb_strlen(\$content) = " . mb_strlen($content), __FILE__);
+ $this->show_form(_('That\'s too long. Max message size is 140 chars.'));
+ return;
+ }
}
$other = User::staticGet('id', $to);
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 37cca982d..8ea47b235 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -51,10 +51,15 @@ class NewnoticeAction extends Action {
$this->show_form(_('No content!'));
return;
} else if (mb_strlen($content) > 140) {
- common_debug("Content = '$content'", __FILE__);
- common_debug("mb_strlen(\$content) = " . mb_strlen($content), __FILE__);
- $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
- return;
+
+ $content = common_shorten_links($content);
+
+ if (mb_strlen($content) > 140) {
+ common_debug("Content = '$content'", __FILE__);
+ common_debug("mb_strlen(\$content) = " . mb_strlen($content), __FILE__);
+ $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
+ return;
+ }
}
$inter = new CommandInterpreter();
diff --git a/actions/postnotice.php b/actions/postnotice.php
index be486a1e9..b4a272e61 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -59,8 +59,11 @@ class PostnoticeAction extends Action {
}
$content = $req->get_parameter('omb_notice_content');
if (!$content || strlen($content) > 140) {
- common_user_error(_('Invalid notice content'), 400);
- return false;
+ $content = common_shorten_links($content);
+ if (mb_strlen($content) > 140) {
+ common_user_error(_('Invalid notice content'), 400);
+ return false;
+ }
}
$notice_uri = $req->get_parameter('omb_notice');
if (!Validate::uri($notice_uri) &&
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index e5698011a..2ae736087 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -224,8 +224,8 @@ class ProfilesettingsAction extends SettingsAction {
} else if ($this->nickname_exists($nickname)) {
$this->show_form(_('Nickname already in use. Try another one.'));
return;
- } else if (!is_null($language) && strlen($language) > 50) {
- $this->show_form(_('Language is too long (max 50 chars).'));
+ } else if (!is_null($language) && strlen($language) > 50) {
+ $this->show_form(_('Language is too long (max 50 chars).'));
}
$user = common_current_user();
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index a0a09a410..3037890ad 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -113,9 +113,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
if (!$content) {
$this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
} else if (mb_strlen($status) > 140) {
- $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
- $code = 406, $apidata['content-type']);
- return;
+ $status = common_shorten_links($status);
+ if (mb_strlen($status) > 140) {
+ $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
+ $code = 406, $apidata['content-type']);
+ return;
+ }
}
$other = $this->get_user($this->trimmed('user'));
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 539a0b1b3..ca79feb4c 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -253,13 +253,19 @@ class TwitapistatusesAction extends TwitterapiAction {
return;
} else if (mb_strlen($status) > 140) {
+
+ $status = common_shorten_links($status);
- // XXX: Twitter truncates anything over 140, flags the status
- // as "truncated." Sending this error may screw up some clients
- // that assume Twitter will truncate for them. Should we just
- // truncate too? -- Zach
- $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
- return;
+ if (mb_strlen($status) > 140) {
+
+ // XXX: Twitter truncates anything over 140, flags the status
+ // as "truncated." Sending this error may screw up some clients
+ // that assume Twitter will truncate for them. Should we just
+ // truncate too? -- Zach
+ $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
+ return;
+
+ }
}
// Check for commands