summaryrefslogtreecommitdiff
path: root/FS/FS/part_export
diff options
context:
space:
mode:
authorMike Robinson <miker@freeside.biz>2012-04-27 14:47:57 -0500
committerMike Robinson <miker@freeside.biz>2012-04-27 14:47:57 -0500
commit03dc5996825a284a3bb922324402730f9f2e404f (patch)
tree7a08b61ef981b0dc37b7cdac2bd1954bb2126589 /FS/FS/part_export
parentd54109cc3035ce63ab0f6c2ec94317e378887d49 (diff)
Netsapiens export; check URLs for validity. (#14919)
A new "check_options()" subroutine is added to option_Common.pm which is called by "insert" and "replace." (Do-nothing routine provided, designed to be overridden.) A "real" implementation is provided in netsapiens.pm.
Diffstat (limited to 'FS/FS/part_export')
-rw-r--r--FS/FS/part_export/netsapiens.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/FS/FS/part_export/netsapiens.pm b/FS/FS/part_export/netsapiens.pm
index 867c19a..b30951d 100644
--- a/FS/FS/part_export/netsapiens.pm
+++ b/FS/FS/part_export/netsapiens.pm
@@ -5,6 +5,7 @@ use MIME::Base64;
use Tie::IxHash;
use FS::part_export;
use Date::Format qw( time2str );
+use Regexp::Common qw/URI/;
@ISA = qw(FS::part_export);
$me = '[FS::part_export::netsapiens]';
@@ -80,6 +81,22 @@ END
sub rebless { shift; }
+
+sub check_options {
+ my ($self, $options) = @_;
+
+ my $rex = qr/$RE{URI}{HTTP}{-scheme => qr|https?|}/; # match any "http:" or "https:" URL
+
+ for my $key (qw/url device_url/) {
+ if ($$options{$key} && ($$options{$key} !~ $rex)) {
+ return "Invalid (URL): " . $$options{$key};
+ }
+ }
+ return '';
+}
+
+
+
sub ns_command {
my $self = shift;
$self->_ns_command('', @_);