Rewrite from stelzi implemented, variable and function name renamed to match with...
[mailer.git] / inc / modules / guest / what-register.php
index ea30251620eac9afdcd6df92894b141b1195d670..c856e14dd790119f9e780bffeccddd7ca58978a6 100644 (file)
@@ -51,7 +51,7 @@ ADD_DESCR('guest', __FILE__);
 global $DATA;
 
 // Initialize variables
 global $DATA;
 
 // Initialize variables
-$FAILED = false; $SHORT_PASS = false; $cats = 0; $IP_TIMEOUT = false;
+$isFailed = false; $SHORT_PASS = false; $cats = 0; $IP_TIMEOUT = false;
 
 if (!IS_FORM_SENT()) REQUEST_UNSET_POST('ok');
 
 
 if (!IS_FORM_SENT()) REQUEST_UNSET_POST('ok');
 
@@ -96,28 +96,28 @@ if (IS_FORM_SENT()) {
        // Did he agree to our Terms Of Usage?
        if (REQUEST_POST('agree') != 'Y') {
                REQUEST_SET_POST('agree', '!');
        // Did he agree to our Terms Of Usage?
        if (REQUEST_POST('agree') != 'Y') {
                REQUEST_SET_POST('agree', '!');
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
 
        // Did he enter a valid email address? (we really don't care about
        // that, he has to click on a confirmation link :P )
        } // END - if
 
        // Did he enter a valid email address? (we really don't care about
        // that, he has to click on a confirmation link :P )
-       if ((!REQUEST_ISSET_POST(('addy'))) || (!VALIDATE_EMAIL(REQUEST_POST('addy')))) {
+       if ((!REQUEST_ISSET_POST(('addy'))) || (!isEmailValid(REQUEST_POST('addy')))) {
                REQUEST_SET_POST('addy', '!');
                REQUEST_SET_POST('addy', '!');
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
 
        // And what about surname and family's name?
        if (!REQUEST_ISSET_POST(('surname'))) {
                REQUEST_SET_POST('surname', '!');
        } // END - if
 
        // And what about surname and family's name?
        if (!REQUEST_ISSET_POST(('surname'))) {
                REQUEST_SET_POST('surname', '!');
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
        if (!REQUEST_ISSET_POST(('family'))) {
                REQUEST_SET_POST('family', '!');
        } // END - if
        if (!REQUEST_ISSET_POST(('family'))) {
                REQUEST_SET_POST('family', '!');
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
 
        // Check for required fields
        } // END - if
 
        // Check for required fields
-       if (!$FAILED) $FAILED = REGISTER_CHECK_REQUIRED_FIELDS(REQUEST_POST_ARRAY());
+       if ($isFailed === false) $isFailed = REGISTER_CHECK_REQUIRED_FIELDS(REQUEST_POST_ARRAY());
 
        // Did he enter his password twice?
        if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
 
        // Did he enter his password twice?
        if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
@@ -128,13 +128,13 @@ if (IS_FORM_SENT()) {
                        if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
                        if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
                }
                        if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
                        if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
                }
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
 
        // Is the password long enouth?
        } // END - if
 
        // Is the password long enouth?
-       if ((strlen(REQUEST_POST('pass1')) < getConfig('pass_len')) && (!$FAILED)) {
+       if ((strlen(REQUEST_POST('pass1')) < getConfig('pass_len')) && ($isFailed === false)) {
                $SHORT_PASS = true;
                $SHORT_PASS = true;
-               $FAILED = true;
+               $isFailed = true;
        } // END - if
 
        // No admin? Admins can always register!
        } // END - if
 
        // No admin? Admins can always register!
@@ -146,7 +146,7 @@ if (IS_FORM_SENT()) {
 
                if ($cats < getConfig('least_cats')) {
                        // ... nope!
 
                if ($cats < getConfig('least_cats')) {
                        // ... nope!
-                       $FAILED = true;
+                       $isFailed = true;
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -155,7 +155,7 @@ if (IS_FORM_SENT()) {
                $CHK = isEmailTaken(REQUEST_POST('addy'));
                if ($CHK === true) {
                        REQUEST_SET_POST('addy', '?');
                $CHK = isEmailTaken(REQUEST_POST('addy'));
                if ($CHK === true) {
                        REQUEST_SET_POST('addy', '?');
-                       $FAILED = true;
+                       $isFailed = true;
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -168,7 +168,7 @@ if (IS_FORM_SENT()) {
                        // Same IP in timeout range and different email address entered... Eat this, faker! ;-)
                        // But admins are allowed to fake their own exchange service.
                        $IP_TIMEOUT = true;
                        // Same IP in timeout range and different email address entered... Eat this, faker! ;-)
                        // But admins are allowed to fake their own exchange service.
                        $IP_TIMEOUT = true;
-                       $FAILED = true;
+                       $isFailed = true;
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -176,7 +176,7 @@ if (IS_FORM_SENT()) {
        SQL_FREERESULT($result);
 }
 
        SQL_FREERESULT($result);
 }
 
-if ((IS_FORM_SENT()) && ((!$FAILED) || (IS_ADMIN()))) {
+if ((IS_FORM_SENT()) && (($isFailed === false) || (IS_ADMIN()))) {
        // Prepapre month and day of birth
        if (strlen(REQUEST_POST('day'))   == 1) REQUEST_SET_POST('day'  , '0'.REQUEST_POST('day'));
        if (strlen(REQUEST_POST('month')) == 1) REQUEST_SET_POST('month', '0'.REQUEST_POST('month'));
        // Prepapre month and day of birth
        if (strlen(REQUEST_POST('day'))   == 1) REQUEST_SET_POST('day'  , '0'.REQUEST_POST('day'));
        if (strlen(REQUEST_POST('month')) == 1) REQUEST_SET_POST('month', '0'.REQUEST_POST('month'));