[Mapbender-commits] r9610 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Sep 29 08:18:36 PDT 2016
Author: armin11
Date: 2016-09-29 08:18:36 -0700 (Thu, 29 Sep 2016)
New Revision: 9610
Modified:
trunk/mapbender/http/classes/class_administration.php
Log:
New possibility to integrate distributed or local geojson files in the initial wmc for the gui by using some get parameter
Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php 2016-09-29 15:18:22 UTC (rev 9609)
+++ trunk/mapbender/http/classes/class_administration.php 2016-09-29 15:18:36 UTC (rev 9610)
@@ -45,6 +45,25 @@
}
/**
+ * checks whether the passed url is valid / following a pattern
+ * TODO: pattern 3 is quiet simple - use better expr to test for webresources
+ * http://stackoverflow.com/questions/206059/php-validation-regex-for-url
+ * answer 8
+ * @param <string> a the url to test
+ * @return <boolean> answer to "is the passed over url valid?""
+ */
+ function validateUrl($URL) {
+ $pattern_1 = "/^(http|https|ftp):\/\/((([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|de|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)|localhost)(:(\d+))?\/?/i";
+ $pattern_2 = "/^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|de|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i";
+ $pattern_3 = "/^(http|https|ftp):\/\//i";
+ if(preg_match($pattern_1, $URL) || preg_match($pattern_2, $URL) || preg_match($pattern_3, $URL)){
+ return true;
+ } else{
+ return false;
+ }
+ }
+
+ /**
* sends an email via php mailer
*
* @param string an email address for the "From"-field
More information about the Mapbender_commits
mailing list