summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-03-06 06:57:58 +0000
committerDries Buytaert <dries@buytaert.net>2005-03-06 06:57:58 +0000
commit42a085c8add0db708d848cfc79c7aa8fe2e0587a (patch)
tree7a7e6a537a2e6149b3a68c09efba9166005df2ba
parent344f33f6af7ad9739913d932b73d8d6575aafff8 (diff)
downloadbrdo-42a085c8add0db708d848cfc79c7aa8fe2e0587a.tar.gz
brdo-42a085c8add0db708d848cfc79c7aa8fe2e0587a.tar.bz2
- 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.
-rw-r--r--includes/common.inc5
1 files changed, 3 insertions, 2 deletions
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);
}
}