fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-12 01:50 pm

[dw-free] admin/propedit.bml has some potential issues with saving display value versus raw value

[commit: http://hg.dwscoalition.org/dw-free/rev/68507e240fe8]

http://bugs.dwscoalition.org/show_bug.cgi?id=3127

Restore and save the property's raw value, rather than the display value (in
a few very limited cases, the two may not match). Also skip a couple of form
values that aren't properties.

Patch by [personal profile] fu.

Files modified:
  • htdocs/admin/propedit.bml
--------------------------------------------------------------------------------
diff -r 47ef8a829f05 -r 68507e240fe8 htdocs/admin/propedit.bml
--- a/htdocs/admin/propedit.bml	Tue Oct 12 19:10:40 2010 +0800
+++ b/htdocs/admin/propedit.bml	Tue Oct 12 21:49:53 2010 +0800
@@ -50,6 +50,9 @@ body<=
             foreach my $key ( keys %POST ) {
                 next if $key eq 'username';
                 next if $key eq '_save';
+                next if $key eq 'value';
+                next if $key eq 'lj_form_auth';
+
                 next unless LJ::get_prop( "user", $key );
                 $u->set_prop( $key, $POST{$key} );
             }
@@ -87,7 +90,7 @@ body<=
         $ret .= "<ul>";
         while ( my $p = $sth->fetchrow_hashref ) {
             my $extra = "<br /><small>$p->{des}</small>";
-            my $value = $u->prop($p->{name});
+            my $value = $u->raw_prop( $p->{name} );
             $value = "<br />" . LJ::html_text({ name => $p->{name}, value => $value, maxlength => '255', size => '100' }) if $can_save;
             $ret .= "<li><strong>$p->{name}</strong>: $value$extra</li><br />";
         }
--------------------------------------------------------------------------------