From 42a085c8add0db708d848cfc79c7aa8fe2e0587a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 6 Mar 2005 06:57:58 +0000 Subject: - Patch #18437 by Mathias: Drupal doesn't allow URL aliases that map to Userland Manila posts since they usually contain the '$' and are considered an invalid URL. This patch allows '$' in an URL and thus an alias. It also resolves a disparity between the 'allowable characters' of absolute and relative URLs. As far as I can tell, those parts of the regexp should be the same. --- includes/common.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index a15bee61c..f326bdeca 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -596,11 +596,12 @@ function valid_email_address($mail) { * TRUE if the URL is in a valid format. */ function valid_url($url, $absolute = FALSE) { + $allowed_characters = '[a-z0-9\/:_\-_\.\?\$,~=#&%\+]'; if ($absolute) { - return preg_match("/^(http|https|ftp):\/\/[a-z0-9\/:_\-_\.\?,~=#&%\+]+$/i", $url); + return preg_match("/^(http|https|ftp):\/\/". $allowed_characters ."+$/i", $url); } else { - return preg_match("/^[a-z0-9\/:_\-_\.,\+]+$/i", $url); + return preg_match("/^". $allowed_characters ."+$/i", $url); } } -- cgit v1.2.3