summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 145cb07a8..e846f8640 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -299,6 +299,21 @@ function valid_email_address($mail) {
}
/**
+ * Verify the syntax of the given URL.
+ *
+ * @param $url an URL
+ */
+function valid_url($url) {
+
+ if (preg_match("/^[a-zA-z0-9\/:_\-_\.]+$/", $url)) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+/**
* Format a single result entry of a search query:
*
* @param $item a single search result as returned by <module>_search of type