Committer: amyshkin
LJSV-2175: Music field on update page can't handle HTMLU trunk/cgi-bin/LJ/Constants.pm U trunk/cgi-bin/ljprotocol.pl U trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/LJ/Constants.pm =================================================================== --- trunk/cgi-bin/LJ/Constants.pm 2012-04-17 10:04:28 UTC (rev 21730) +++ trunk/cgi-bin/LJ/Constants.pm 2012-04-17 10:47:09 UTC (rev 21731) @@ -30,6 +30,7 @@ use constant CMAX_KEYWORD => 40; use constant BMAX_PROP => 255; # logprop[2]/talkprop[2]/userproplite (not userprop) use constant CMAX_PROP => 100; +use constant CMMAX_PROP => 254; # current_music length limit use constant BMAX_GRPNAME => 60; use constant CMAX_GRPNAME => 30; use constant BMAX_GRPNAME2 => 90; # introduced in dversion6, when we widened the groupname column Modified: trunk/cgi-bin/ljprotocol.pl =================================================================== --- trunk/cgi-bin/ljprotocol.pl 2012-04-17 10:04:28 UTC (rev 21730) +++ trunk/cgi-bin/ljprotocol.pl 2012-04-17 10:47:09 UTC (rev 21731) @@ -1985,6 +1985,8 @@ # Allow syn_links and syn_ids the full width of the prop, to avoid truncating long URLS if ($_ eq 'syn_link' || $_ eq 'syn_id') { $req->{'props'}->{$_} = LJ::text_trim($req->{'props'}->{$_}, LJ::BMAX_PROP); + } elsif ( $_ eq 'current_music' ) { + $req->{'props'}->{$_} = LJ::text_trim($req->{'props'}->{$_}, LJ::CMMAX_PROP); } else { $req->{'props'}->{$_} = LJ::text_trim($req->{'props'}->{$_}, LJ::BMAX_PROP, LJ::CMAX_PROP); } @@ -2886,7 +2888,7 @@ } my $itemid = $req->{'itemid'}+0; - + $itemid ||= int( ($req->{'ditemid'} + 0) / 256); # underage users can't do this @@ -2922,7 +2924,7 @@ # but we've already removed the utf-8 flag in the XML-RPC path, and it # never gets set in the "flat" protocol path return fail($err, 409) if length($req->{event}) >= LJ::BMAX_EVENT; - + if ( $req->{ver} > 3 && LJ::is_enabled("delayed_entries") && $req->{delayedid} ) { my $delayedid = delete $req->{delayedid}; my $res = {}; @@ -2944,7 +2946,7 @@ if ($req->{'event'} !~ /\S/ ) { $entry->delete(); $res->{delayedid} = $delayedid; - + $uowner->log_event('delete_entry', { remote => $u, actiontarget => $delayedid, @@ -2996,8 +2998,7 @@ ### what can they do to somebody elses entry? (in shared journal) ### can edit it if they own or maintain the journal, but not if the journal is read-only - if ($posterid != $oldevent->{'posterid'} || $u->is_readonly || $uowner->is_readonly) - { + if ($posterid != $oldevent->{'posterid'} || $u->is_readonly || $uowner->is_readonly) { ## deleting. return fail($err,304) if ($req->{'event'} !~ /\S/ && ! @@ -3075,11 +3076,11 @@ if ( $itemid == $uowner->get_sticky_entry_id() ) { $uowner->remove_sticky_entry_id(); } - - $dbh->do("UPDATE userusage SET timeupdate=NOW() ". - "WHERE userid=$ownerid"); - LJ::MemCache::set([$ownerid, "tu:$ownerid"], pack("N", time()), 30*60); + $dbh->do("UPDATE userusage SET timeupdate=NOW() ". + "WHERE userid=$ownerid"); + LJ::MemCache::set([$ownerid, "tu:$ownerid"], pack("N", time()), 30*60); + return $res; } Modified: trunk/cgi-bin/weblib.pl =================================================================== --- trunk/cgi-bin/weblib.pl 2012-04-17 10:04:28 UTC (rev 21730) +++ trunk/cgi-bin/weblib.pl 2012-04-17 10:47:09 UTC (rev 21731) @@ -1168,7 +1168,7 @@ $req->{'prop_current_music'} = substr( $POST->{'prop_current_music'}, 0, 197 ) . '...'; } else { - $req->{'prop_current_music'} = substr( substr($POST->{'prop_current_music'}, 0, $pos), 0, 197 ) . '...' . substr( $POST->{'prop_current_music'}, $pos + 1 ); + $req->{'prop_current_music'} = substr( substr($POST->{'prop_current_music'}, 0, $pos), 0, 197 ) . '... ' . substr( $POST->{'prop_current_music'}, $pos ); } } else {