use Exporter 'import';
our @EXPORT_OK = qw(utf8param
trimField
+ utf8paramTrim
isodate
xml_encode
cql_quote
return $cooked;
}
-
# Utility functions follow, exported for use of web UI
sub utf8param_apache1 {
my($r, $key, $value) = @_;
return $field;
}
+# utf8param() with trim
+sub utf8paramTrim {
+ my $result = utf8param(@_);
+
+ if (defined $result) {
+ $result = trimField($result);
+ }
+
+ return $result;
+}
+
# I can't -- just can't, can't, can't -- believe that this function
# isn't provided by one of the core XML modules. But the evidence all
# says that it's not: among other things, XML::Generator and
user => "admin", password => "fruitbat",
elementSetName => "zeerex");
-my $protocol = utf8param($r, "protocol");
-my $host = utf8param($r, "host");
-my $port = utf8param($r, "port");
-my $dbname = utf8param($r, "dbname");
+my $protocol = utf8paramTrim($r, "protocol");
+my $host = utf8paramTrim($r, "host");
+my $port = utf8paramTrim($r, "port");
+my $dbname = utf8paramTrim($r, "dbname");
+my $title = utf8paramTrim($r, "title");
if ((!defined $port || $port eq "") &&
(defined $protocol && $protocol ne "")) {
if (defined $protocol && $protocol ne "" &&
defined $host && $host ne "" &&
defined $port && $port ne "" &&
+ defined $title && $title ne "" &&
defined $dbname && $dbname ne "") {
$newid = irspy_make_identifier($protocol, $host, $port, $dbname);
}
} elsif (!defined $newid) {
# Tried to create new record but data is insufficient
print qq[<p class="error">
- Please specify protocol, host, port and database name.</p>\n];
+ Please specify title, protocol, host, port and database name.</p>\n];
undef $update;
} elsif ($host !~ /^\w+\.[\w.]*\w$/i) {
print qq[<p class="error">