From 5ab4f320b5f9860ce1b37de7ad6ba4abfed69bf9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Apr 2009 13:01:45 +0000 Subject: [PATCH] Added : url string validation --- htdocs/lib/functions.lib.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 8bed2d576a0..3227dd967da 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Christophe Combelles - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -2379,9 +2379,9 @@ function clean_url($url,$http=1) } // On passe le nom de domaine en minuscule - $url = eregi_replace('^'.$proto.$domain, $newproto.strtolower($domain), $url); + $CleanUrl = eregi_replace('^'.$proto.$domain, $newproto.strtolower($domain), $url); - return $url; + return $CleanUrl; } } @@ -2400,6 +2400,7 @@ function clean_url($url,$http=1) */ function valid_url($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0) { + $ValidUrl = 0; $urlregex = ''; // SCHEME @@ -2426,12 +2427,10 @@ function valid_url($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0) // check if (eregi($urlregex, $url)) { - return 1; - } - else - { - return 0; + $ValidUrl = 1; } + + return $ValidUrl; }