From 7ba0b1b75ca2b3ff720f7ddf0e03db882a65353d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 1 Apr 2012 11:36:16 -0700 Subject: Restrict valid urls to having a http:// or https:// prefix. Fixes #1830. --- modules/gallery/helpers/MY_valid.php | 26 ++++++++++++++++++++++++++ modules/gallery/tests/Valid_Test.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 modules/gallery/helpers/MY_valid.php create mode 100644 modules/gallery/tests/Valid_Test.php (limited to 'modules/gallery') diff --git a/modules/gallery/helpers/MY_valid.php b/modules/gallery/helpers/MY_valid.php new file mode 100644 index 00000000..68712302 --- /dev/null +++ b/modules/gallery/helpers/MY_valid.php @@ -0,0 +1,26 @@ +assert_true(valid::url("http://foo.bar.com")); + $this->assert_true(valid::url("https://foo.bar.com")); + + $this->assert_false(valid::url("mailto://bar")); + $this->assert_false(valid::url("ftp://bar")); + } +} \ No newline at end of file -- cgit v1.2.3