]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-register.php
Complete rewrite and debug message surpressed:
[mailer.git] / inc / modules / guest / what-register.php
index c856e14dd790119f9e780bffeccddd7ca58978a6..44b47978d9b3219859bafc82492e5bdb620105ad 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 } elseif ((!EXT_IS_ACTIVE('register'))) {
-       addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'register'));
+       addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('register'));
        return;
 }
 
@@ -53,7 +53,7 @@ global $DATA;
 // Initialize variables
 $isFailed = false; $SHORT_PASS = false; $cats = 0; $IP_TIMEOUT = false;
 
-if (!IS_FORM_SENT()) REQUEST_UNSET_POST('ok');
+if (!isFormSent()) REQUEST_UNSET_POST('ok');
 
 if (!REQUEST_ISSET_POST(('agree')))        REQUEST_SET_POST('agree'       , '');
 if (!REQUEST_ISSET_POST(('addy')))         REQUEST_SET_POST('addy'        , '');
@@ -76,7 +76,7 @@ REQUEST_SET_POST('refid', 0);
 if ($GLOBALS['refid'] > 0) {
        // Test if the refid is valid
        $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+       array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
 
        // Userid found?
        //* DEBUG: */ die("refid={$GLOBALS['refid']}/numRows=".SQL_NUMROWS($result)."");
@@ -90,7 +90,7 @@ if ($GLOBALS['refid'] > 0) {
        }
 } // END - if
 
-if (IS_FORM_SENT()) {
+if (isFormSent()) {
        // First we only check the submitted data then we continue... :)
        //
        // Did he agree to our Terms Of Usage?
@@ -163,7 +163,7 @@ if (IS_FORM_SENT()) {
        if (getConfig('ip_timeout') > 0) {
                // Check his IP number
                $result = SQL_QUERY_ESC("SELECT joined, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE REMOTE_ADDR='%s' AND (joined > (UNIX_TIMESTAMP() - %s) OR last_update > (UNIX_TIMESTAMP() - %s)) LIMIT 1",
-                       array(detectRemoteAddr(), getConfig('ip_timeout'), getConfig('ip_timeout')), __FILE__, __LINE__);
+               array(detectRemoteAddr(), getConfig('ip_timeout'), getConfig('ip_timeout')), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Same IP in timeout range and different email address entered... Eat this, faker! ;-)
                        // But admins are allowed to fake their own exchange service.
@@ -176,7 +176,7 @@ if (IS_FORM_SENT()) {
        SQL_FREERESULT($result);
 }
 
-if ((IS_FORM_SENT()) && (($isFailed === false) || (IS_ADMIN()))) {
+if ((isFormSent()) && (($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'));
@@ -198,7 +198,7 @@ if ((IS_FORM_SENT()) && (($isFailed === false) || (IS_ADMIN()))) {
        if (GET_EXT_VERSION('sql_patches') >= '0.2.7') {
                // Okay, add design here
                $ADD1 = ", `curr_theme`";
-               $ADD2 = ', ''.getCurrentTheme().''';
+               $ADD2 = ", '".getCurrentTheme()."'";
        } // END - if
 
        // Check if I shall disable sending mail to newly registered members out about active/begging rallye
@@ -239,24 +239,24 @@ if ((IS_FORM_SENT()) && (($isFailed === false) || (IS_ADMIN()))) {
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_data` (gender, surname, family, street_nr,%s, zip, city, email, birth_day, birth_month, birth_year, password, max_mails, receive_mails, refid, status, user_hash, REMOTE_ADDR, joined, last_update".$ADD1.")
 VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONFIRMED','%s','%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()".$ADD2.")",
        array(
-               $countryRow,
-               substr(REQUEST_POST('gender'), 0, 1),
-               REQUEST_POST('surname'),
-               REQUEST_POST('family'),
-               REQUEST_POST('street_nr'),
-               $countryData,
-               bigintval(REQUEST_POST('zip')),
-               REQUEST_POST('city'),
-               REQUEST_POST('addy'),
-               bigintval(REQUEST_POST('day')),
-               bigintval(REQUEST_POST('month')),
-               bigintval(REQUEST_POST('year')),
-               generateHash(REQUEST_POST('pass1')),
-               bigintval(REQUEST_POST('max_mails')),
-               bigintval(REQUEST_POST('max_mails')),
-               bigintval(REQUEST_POST('refid')),
-               $hash,
-               detectRemoteAddr(),
+       $countryRow,
+       substr(REQUEST_POST('gender'), 0, 1),
+       REQUEST_POST('surname'),
+       REQUEST_POST('family'),
+       REQUEST_POST('street_nr'),
+       $countryData,
+       bigintval(REQUEST_POST('zip')),
+       REQUEST_POST('city'),
+       REQUEST_POST('addy'),
+       bigintval(REQUEST_POST('day')),
+       bigintval(REQUEST_POST('month')),
+       bigintval(REQUEST_POST('year')),
+       generateHash(REQUEST_POST('pass1')),
+       bigintval(REQUEST_POST('max_mails')),
+       bigintval(REQUEST_POST('max_mails')),
+       bigintval(REQUEST_POST('refid')),
+       $hash,
+       detectRemoteAddr(),
        ), __FILE__, __LINE__);
 
        // Get his userid
@@ -278,13 +278,13 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
 
        // Write his welcome-points
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=0 LIMIT 1",
-               array(bigintval($userid)), __FILE__, __LINE__);
+       array(bigintval($userid)), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Add only when the line was not found (maybe some more secure?)
                $locked = "points";
                if (getConfig('ref_payout') > 0) $locked = "locked_points"; // Pay him later. First he has to confirm some mails!
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_points` (userid, ref_depth, ".$locked.") VALUES (%s,0,'%s')",
-                array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
+               array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
 
                // Update mediadata as well
                if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($locked == "points")) {
@@ -299,7 +299,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
                        if ($joined == 'Y') {
                                // Insert category entry
                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_cats` (userid, cat_id) VALUES (%s, %s)",
-                                array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
+                               array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
                        } // END - if
                } // END - foreach
        } // END - if
@@ -349,13 +349,13 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        // Continue with birthday...
        switch (getLanguage())
        {
-       case 'de':
-               $DATA['birthday'] = bigintval(REQUEST_POST('day')).'.'.bigintval(REQUEST_POST('month')).'.'.bigintval(REQUEST_POST('year'));
-               break;
+               case 'de':
+                       $DATA['birthday'] = bigintval(REQUEST_POST('day')).'.'.bigintval(REQUEST_POST('month')).'.'.bigintval(REQUEST_POST('year'));
+                       break;
 
-       default:
-               $DATA['birthday'] = bigintval(REQUEST_POST('month')).'/'.bigintval(REQUEST_POST('day')).'/'.bigintval(REQUEST_POST('year'));
-               break;
+               default:
+                       $DATA['birthday'] = bigintval(REQUEST_POST('month')).'/'.bigintval(REQUEST_POST('day')).'/'.bigintval(REQUEST_POST('year'));
+                       break;
        }
 
        // Display information to the user that he got mail and send it away
@@ -417,13 +417,13 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        // Generate birthday selection
        switch (getLanguage())
        {
-       case 'de': // German date format
-               define('BIRTHDAY_SELECTION', ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('year', REQUEST_POST('year')));
-               break;
+               case 'de': // German date format
+                       define('BIRTHDAY_SELECTION', ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('year', REQUEST_POST('year')));
+                       break;
 
-       default: // Default is the US date format... :)
-               define('BIRTHDAY_SELECTION', ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('year', REQUEST_POST('year')));
-               break;
+               default: // Default is the US date format... :)
+                       define('BIRTHDAY_SELECTION', ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('year', REQUEST_POST('year')));
+                       break;
        }
 
        // Adds a table for the guests with all visible categories
@@ -452,7 +452,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        define('__FAMILY',  SQL_ESCAPE(REQUEST_POST('family')));
        define('__STREET',  SQL_ESCAPE(REQUEST_POST('street_nr')));
        define('__COUNTRY', SQL_ESCAPE(REQUEST_POST('cntry')));
-       if (REQUEST_ISSET_POST('zip')) {
+       if ((REQUEST_ISSET_POST('zip')) && (REQUEST_POST('zip') != '')) {
                define('__ZIP', bigintval(REQUEST_POST('zip')));
        } else {
                define('__ZIP', '');