aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-14 00:32:31 -0800
committerFriendika <info@friendika.com>2010-11-14 00:32:31 -0800
commit0851669b39db770e62374551c9394f0f3a652314 (patch)
treebf5dbba7080891dea1b48151022bc915d23c64c0 /mod
parent7db4a0dd2ee631c4b0652e5852b1bb6f5ca50e63 (diff)
downloadvolse-hubzilla-0851669b39db770e62374551c9394f0f3a652314.tar.gz
volse-hubzilla-0851669b39db770e62374551c9394f0f3a652314.tar.bz2
volse-hubzilla-0851669b39db770e62374551c9394f0f3a652314.zip
clean up some regex's for i18n, and eliminate old ereg patterns.
Diffstat (limited to 'mod')
-rw-r--r--mod/invite.php7
-rw-r--r--mod/register.php15
-rw-r--r--mod/settings.php4
3 files changed, 15 insertions, 11 deletions
diff --git a/mod/invite.php b/mod/invite.php
index 3f9efc574..fe706a524 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -17,12 +17,13 @@ function invite_post(&$a) {
$recip = trim($recip);
- if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}', $recip)) {
- notice( $recip . t(' : ') . t('Not a valid email address.') . EOL);
+ if(! valid_email($recip)) {
+ notice( $recip . t(' : ') . t('Not a valid email address.') . EOL);
continue;
}
- $res = mail($recip, t('Please join my network on ') . $a->config['sitename'], $message, "From: " . $a->user['email']);
+ $res = mail($recip, t('Please join my network on ') . $a->config['sitename'],
+ $message, "From: " . $a->user['email']);
if($res) {
$total ++;
}
diff --git a/mod/register.php b/mod/register.php
index 99823f451..a0a5e5c28 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -46,7 +46,7 @@ function register_post(&$a) {
// TODO fix some of these regex's for int'l/utf-8.
- if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
+ if(! valid_email($email))
$err .= t(' Not a valid email address.');
if(strlen($username) > 48)
$err .= t(' Please use a shorter name.');
@@ -55,19 +55,22 @@ function register_post(&$a) {
// I don't really like having this rule, but it cuts down
// on the number of auto-registrations by Russian spammers
+
+ $no_utf = get_config('system','no_utf');
- if(! preg_match("/^[a-zA-Z]* [a-zA-Z]*$/",$username))
- $err .= t(' That doesn\'t appear to be your full name.');
+ $pat = (($no_utf) ? '/^[a-zA-Z]* [a-zA-Z]*$/' : '/^\p{L}* \p{L}*$/u' );
- if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
- $err .= t(' Not valid email.');
+ $loose_reg = get_config('system','no_regfullname');
+
+ if((! $loose_reg) && (! preg_match($pat,$username)))
+ $err .= t(' That doesn\'t appear to be your full name.');
if(! allowed_email($email))
$err .= t(' Your email domain is not among those allowed on this site.');
$nickname = strtolower($nickname);
if(! preg_match("/^[a-z][a-z0-9\-\_]*$/",$nickname))
- $err .= t(' Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.') ;
+ $err .= t(' Your "nickname" can only contain "a-z", "0-9", "-", and "_", and must also begin with a letter.');
$r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname)
diff --git a/mod/settings.php b/mod/settings.php
index eab4ac52e..0687a498f 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -86,8 +86,8 @@ function settings_post(&$a) {
if($email != $a->user['email']) {
$email_changed = true;
- if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
- $err .= t(' Not valid email.');
+ if(! valid_email($email))
+ $err .= t(' Not valid email.');
}
if(strlen($err)) {