All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit fea90641 authored by Russ Fish's avatar Russ Fish

Fix whitespace and null string handling problems.

         www/beginexp_form.php3 - No initial whitespace in plab Slice Description textarea.
         sql/database-fill.sql - Use default:fulltext for 'experiments','expt_name'
             to allow multi-line Slice Description in plab_ez->beginexp->batchexp.
         www/moduserinfo.php3 - Pass null string for optional usr_addr2 and notes fields.
         backend/moduserinfo.in - Null string attr comes from XML as an undef value.
         db/User.pm.in - Distinguish between undef and null string in ModUserInfo.
parent 848c1f9c
...@@ -190,6 +190,9 @@ my %moduserinfo_args = (); ...@@ -190,6 +190,9 @@ my %moduserinfo_args = ();
foreach my $key (keys(%{ $xmlparse->{'attribute'} })) { foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
my $value = $xmlparse->{'attribute'}->{"$key"}->{'value'}; my $value = $xmlparse->{'attribute'}->{"$key"}->{'value'};
if (!defined($value)) { # Empty string comes from XML as an undef value.
$xmlparse->{'attribute'}->{"$key"}->{'value'} = $value = "";
}
if ($debug) { if ($debug) {
print STDERR "User attribute: '$key' -> '$value'\n"; print STDERR "User attribute: '$key' -> '$value'\n";
......
...@@ -765,7 +765,7 @@ sub ModUserInfo($$$$) ...@@ -765,7 +765,7 @@ sub ModUserInfo($$$$)
# any email or external updates for this. # any email or external updates for this.
# #
my $notes = $argref->{"notes"}; my $notes = $argref->{"notes"};
if ($notes && $isadmin && $target_user->notes() ne $notes) { if (defined($notes) && $isadmin && $target_user->notes() ne $notes) {
$target_user->SetNotes($notes); $target_user->SetNotes($notes);
$noreport = 1; $noreport = 1;
} }
...@@ -774,7 +774,7 @@ sub ModUserInfo($$$$) ...@@ -774,7 +774,7 @@ sub ModUserInfo($$$$)
# Set the plab bit separately since no need to call out to the backend. # Set the plab bit separately since no need to call out to the backend.
# #
my $ui = $argref->{"user_interface"}; my $ui = $argref->{"user_interface"};
if ($ui && $target_user->user_interface() ne $ui) { if (defined($ui) && $target_user->user_interface() ne $ui) {
$target_user->SetUserInterface($ui); $target_user->SetUserInterface($ui);
$noreport = 1; $noreport = 1;
} }
......
...@@ -731,7 +731,7 @@ REPLACE INTO table_regex VALUES ('experiments','jail_osname','text','redirect',' ...@@ -731,7 +731,7 @@ REPLACE INTO table_regex VALUES ('experiments','jail_osname','text','redirect','
REPLACE INTO table_regex VALUES ('experiments','delay_osname','text','redirect','os_info:osname',0,0,NULL); REPLACE INTO table_regex VALUES ('experiments','delay_osname','text','redirect','os_info:osname',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','use_ipassign','int','redirect','default:boolean',0,0,NULL); REPLACE INTO table_regex VALUES ('experiments','use_ipassign','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','ipassign_args','text','regex','^[\\w\\s-]*$',0,255,NULL); REPLACE INTO table_regex VALUES ('experiments','ipassign_args','text','regex','^[\\w\\s-]*$',0,255,NULL);
REPLACE INTO table_regex VALUES ('experiments','expt_name','text','redirect','default:tinytext',1,255,NULL); REPLACE INTO table_regex VALUES ('experiments','expt_name','text','redirect','default:fulltext',1,255,NULL);
REPLACE INTO table_regex VALUES ('experiments','dpdb','int','redirect','default:tinyint',0,1,NULL); REPLACE INTO table_regex VALUES ('experiments','dpdb','int','redirect','default:tinyint',0,1,NULL);
REPLACE INTO table_regex VALUES ('experiments','description','text','regex','^[\\040-\\176\\012\\015\\011]*$',1,256,NULL); REPLACE INTO table_regex VALUES ('experiments','description','text','regex','^[\\040-\\176\\012\\015\\011]*$',1,256,NULL);
......
...@@ -363,9 +363,9 @@ function SPITFORM($formfields, $errors) ...@@ -363,9 +363,9 @@ function SPITFORM($formfields, $errors)
<td class='pad4' class=left> <td class='pad4' class=left>
<textarea <textarea
name=\"formfields[exp_description]\" name=\"formfields[exp_description]\"
rows=5 cols=50>". rows=5 cols=50>" .
$formfields['exp_description'] ." $formfields['exp_description'] .
</textarea> "</textarea>
</td> </td>
</tr>\n"; </tr>\n";
} else { } else {
......
...@@ -507,7 +507,7 @@ if (isset($formfields["usr_addr"]) && $formfields["usr_addr"] != "" && ...@@ -507,7 +507,7 @@ if (isset($formfields["usr_addr"]) && $formfields["usr_addr"] != "" &&
$formfields["usr_addr"] != $target_user->addr()) { $formfields["usr_addr"] != $target_user->addr()) {
$args["usr_addr"] = $formfields["usr_addr"]; $args["usr_addr"] = $formfields["usr_addr"];
} }
if (isset($formfields["usr_addr2"]) && $formfields["usr_addr2"] != "" && if (isset($formfields["usr_addr2"]) &&
$formfields["usr_addr2"] != $target_user->addr2()) { $formfields["usr_addr2"] != $target_user->addr2()) {
$args["usr_addr2"] = $formfields["usr_addr2"]; $args["usr_addr2"] = $formfields["usr_addr2"];
} }
...@@ -535,7 +535,7 @@ if (isset($formfields["user_interface"]) && $formfields["user_interface"] != "" ...@@ -535,7 +535,7 @@ if (isset($formfields["user_interface"]) && $formfields["user_interface"] != ""
$formfields["user_interface"] != $target_user->user_interface()) { $formfields["user_interface"] != $target_user->user_interface()) {
$args["user_interface"] = $formfields["user_interface"]; $args["user_interface"] = $formfields["user_interface"];
} }
if (isset($formfields["notes"]) && $formfields["notes"] != "" && if (isset($formfields["notes"]) &&
$formfields["notes"] != $target_user->notes()) { $formfields["notes"] != $target_user->notes()) {
$args["notes"] = $formfields["notes"]; $args["notes"] = $formfields["notes"];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment