[dw-free] PM subject unreasonably large
[commit: http://hg.dwscoalition.org/dw-free/rev/1990cc16e9d4]
http://bugs.dwscoalition.org/show_bug.cgi?id=3598
Limit to 255 characters.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3598
Limit to 255 characters.
Patch by
Files modified:
- htdocs/inbox/compose.bml
- htdocs/inbox/compose.bml.text
--------------------------------------------------------------------------------
diff -r 73973c3e26ea -r 1990cc16e9d4 htdocs/inbox/compose.bml
--- a/htdocs/inbox/compose.bml Tue Apr 19 22:27:40 2011 +0800
+++ b/htdocs/inbox/compose.bml Wed Apr 20 10:53:12 2011 +0800
@@ -45,6 +45,7 @@ body<=
my $msg_body = ''; # reply body
my $msg_parent = ''; # Hidden msg field containing id of parent message
my $msg_limit = $remote->count_usermessage_length;
+ my $subject_limit = 255;
my $force = 0; # flag for if user wants to force an empty PM
my @errors;
@@ -63,6 +64,13 @@ body<=
my $msg_subject_text = $POST{'msg_subject'};
push @errors, $ML{'.error.text.encoding.subject'}
unless LJ::text_in($msg_subject_text);
+ my ( $subject_length_b, $subject_length_c ) = LJ::text_length( $msg_subject_text );
+ push @errors, BML::ml( ".error.subject.length",
+ {
+ subject_length => LJ::commafy( $subject_length_c ),
+ subject_limit => LJ::commafy( $subject_limit ),
+ } )
+ unless $subject_length_c <= $subject_limit;
# test encoding and length
my $msg_body_text = $POST{'msg_body'};
@@ -275,6 +283,7 @@ body<=
$body .= LJ::html_text({
name => 'msg_subject',
size => '50',
+ maxlength => $subject_limit,
value => $POST{'msg_subject'} || $msg_subject,
class => 'subj-t'
});
diff -r 73973c3e26ea -r 1990cc16e9d4 htdocs/inbox/compose.bml.text
--- a/htdocs/inbox/compose.bml.text Tue Apr 19 22:27:40 2011 +0800
+++ b/htdocs/inbox/compose.bml.text Wed Apr 20 10:53:12 2011 +0800
@@ -9,6 +9,8 @@
.error.no.username=Please enter a valid username
.error.rate.limit=This message will exceed your limit and cannot be sent.[[up]]
+
+.error.subject.length=Subject is too long ([[subject_length]] characters). It should not exceed [[subject_limit]] characters.
.error.text.encoding.subject=Invalid text encoding for message subject
--------------------------------------------------------------------------------
