sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r19694: LJSUP-9472: Check the length of user's a...

Committer: vtroitsky
LJSUP-9472: Check the length of user's answers to text type questions added.
U   trunk/cgi-bin/LJ/Poll.pm
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm	2011-08-11 03:50:11 UTC (rev 19693)
+++ trunk/cgi-bin/LJ/Poll.pm	2011-08-11 04:01:41 UTC (rev 19694)
@@ -1880,6 +1880,12 @@
                 }
             } elsif ($q->type ne 'text') {
                 push @vals, $val;
+            } elsif ($q->type eq 'text') {
+                my ($size, $maxlength) = split(m!/!, $q->opts);
+                if (length($val) > $maxlength) {
+                    $$error = LJ::Lang::ml('poll.error.pollitid');
+                    return 0;
+                }
             }
             if ($q->type ne 'text' && $q->type ne 'scale' && $opts{wrong_value_as_error}) {
                 my %pollitids;

Tags: livejournal, pm, sunnyman
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments