Heavy rewrite:
[mailer.git] / inc / modules / guest / what-register.php
index 44790f134a8571fed7830ce8722a04230a5f6ee1..51470e2436550892d5945e6392bb6ea1a05f9f56 100644 (file)
@@ -56,30 +56,33 @@ $shortPass = false;
 $cats       = 0;
 $ipTimedOut = false;
 
+/**
+ * @TODO Commented out, do we need this ugly code?
 if (!isFormSent()) REQUEST_UNSET_POST('ok');
 
-if (!REQUEST_ISSET_POST(('agree')))        REQUEST_SET_POST('agree'       , '');
-if (!REQUEST_ISSET_POST(('addy')))         REQUEST_SET_POST('addy'        , '');
-if (!REQUEST_ISSET_POST(('surname')))      REQUEST_SET_POST('surname'     , '');
-if (!REQUEST_ISSET_POST(('family')))       REQUEST_SET_POST('family'      , '');
+if (!REQUEST_ISSET_POST('agree'))        REQUEST_SET_POST('agree'       , '');
+if (!REQUEST_ISSET_POST('addy'))         REQUEST_SET_POST('addy'        , '');
+if (!REQUEST_ISSET_POST('surname'))      REQUEST_SET_POST('surname'     , '');
+if (!REQUEST_ISSET_POST('family'))       REQUEST_SET_POST('family'      , '');
 if (!REQUEST_ISSET_POST('pass1'))        REQUEST_SET_POST('pass1'       , '');
 if (!REQUEST_ISSET_POST('pass2'))        REQUEST_SET_POST('pass2'       , '');
-if (!REQUEST_ISSET_POST(('day')))          REQUEST_SET_POST('day'         , '');
-if (!REQUEST_ISSET_POST(('month')))        REQUEST_SET_POST('month'       , '');
-if (!REQUEST_ISSET_POST(('year')))         REQUEST_SET_POST('year'        , '');
-if (!REQUEST_ISSET_POST(('max_mails')))    REQUEST_SET_POST('max_mails'   , '');
-if (!REQUEST_ISSET_POST(('street_nr')))    REQUEST_SET_POST('street_nr'   , '');
+if (!REQUEST_ISSET_POST('day'))          REQUEST_SET_POST('day'         , '');
+if (!REQUEST_ISSET_POST('month'))        REQUEST_SET_POST('month'       , '');
+if (!REQUEST_ISSET_POST('year'))         REQUEST_SET_POST('year'        , '');
+if (!REQUEST_ISSET_POST('max_mails'))    REQUEST_SET_POST('max_mails'   , '');
+if (!REQUEST_ISSET_POST('street_nr'))    REQUEST_SET_POST('street_nr'   , '');
 if (!REQUEST_ISSET_POST('zip'))          REQUEST_SET_POST('zip'         , '');
-if (!REQUEST_ISSET_POST(('city')))         REQUEST_SET_POST('city'        , '');
-if (!REQUEST_ISSET_POST(('cntry')))        REQUEST_SET_POST('cntry'       , '');
-if (!REQUEST_ISSET_POST(('country_code'))) REQUEST_SET_POST('country_code', '1');
+if (!REQUEST_ISSET_POST('city'))         REQUEST_SET_POST('city'        , '');
+if (!REQUEST_ISSET_POST('cntry'))        REQUEST_SET_POST('cntry'       , '');
+if (!REQUEST_ISSET_POST('country_code')) REQUEST_SET_POST('country_code', '1');
+*/
 
 // Default refid is zero
 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__);
+       $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+               array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
 
        // Userid found?
        //* DEBUG: */ die("refid={$GLOBALS['refid']}/numRows=".SQL_NUMROWS($result)."");
@@ -104,17 +107,17 @@ if (isFormSent()) {
 
        // 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'))) || (!isEmailValid(REQUEST_POST('addy')))) {
+       if ((!REQUEST_ISSET_POST('addy')) || (!isEmailValid(REQUEST_POST('addy')))) {
                REQUEST_SET_POST('addy', '!');
                $isFailed = true;
        } // END - if
 
        // And what about surname and family's name?
-       if (!REQUEST_ISSET_POST(('surname'))) {
+       if (!REQUEST_ISSET_POST('surname')) {
                REQUEST_SET_POST('surname', '!');
                $isFailed = true;
        } // END - if
-       if (!REQUEST_ISSET_POST(('family'))) {
+       if (!REQUEST_ISSET_POST('family')) {
                REQUEST_SET_POST('family', '!');
                $isFailed = true;
        } // END - if
@@ -288,16 +291,16 @@ 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";
+               $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")) {
+               if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($locked == 'points')) {
                        // Update database
                        MEDIA_UPDATE_ENTRY(array('total_points'), 'add', getConfig('points_register'));
                } // END - if