aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-08 11:19:10 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-08 11:19:10 +0000
commit150d48d5f28f04bda8364ecbe092c5bb27ee4808 (patch)
tree306298b838bbd52392fcd37a37bae84359d3b5e0 /engine/lib
parent23cc2ea83e586f6bf62bdfaf05b1e2d3ba0be2ed (diff)
downloadelgg-150d48d5f28f04bda8364ecbe092c5bb27ee4808.tar.gz
elgg-150d48d5f28f04bda8364ecbe092c5bb27ee4808.tar.bz2
Fixes #2161 - using filter_var() in email validation and moved is_email_address() to the input library
git-svn-id: http://code.elgg.org/elgg/trunk@7036 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/input.php10
-rw-r--r--engine/lib/users.php20
2 files changed, 10 insertions, 20 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php
index 17a330851..324b0cec4 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -107,6 +107,16 @@ function sanitise_filepath($path, $append_slash = TRUE) {
}
/**
+ * Validates an email address.
+ *
+ * @param string $address Email address.
+ * @return bool
+ */
+function is_email_address($address) {
+ return filter_var($address, FILTER_VALIDATE_EMAIL) === $address;
+}
+
+/**
* Page handler for autocomplete endpoint.
*
* @param $page
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 05311ab9d..c9add2541 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -875,26 +875,6 @@ function elgg_user_resetpassword_page_handler($page) {
}
/**
- * Validates an email address.
- *
- * @param string $address Email address.
- * @return bool
- */
-function is_email_address($address) {
- // @todo Make this better!
-
- if (strpos($address, '@')=== false) {
- return false;
- }
-
- if (strpos($address, '.')=== false) {
- return false;
- }
-
- return true;
-}
-
-/**
* Simple function that will generate a random clear text password suitable for feeding into generate_user_password().
*
* @see generate_user_password