Many rewrites to get rid of dublicate modreg inserts while ext-cache is registered
[mailer.git] / doubler.php
index bb9201f1791e33b509aaa70a2c604333f21c6e38..3a3cb93ba46aaf228ace04231e7d1b766a6a667f 100644 (file)
 // Load security stuff here
 require('inc/libs/security_functions.php');
 
-// Init "action" and "what"
+// Init start time
 $GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = '';
-$GLOBALS['action'] = '';
 
 // Set module
 $GLOBALS['module'] = 'doubler';
@@ -66,11 +64,8 @@ if (REQUEST_ISSET_GET(('refid'))) $GLOBALS['refid'] = REQUEST_GET(('refid'));
 
 // Only check this if refid is provided!
 if ($GLOBALS['refid'] > 0) {
-       // Probe for nickname extension and if a nickname was supplied by URL
-       $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round($GLOBALS['refid']).'') != $GLOBALS['refid']));
-
        // Do we have nickname or userid set?
-       if ($probe_nickname === true) {
+       if (isNicknameUsed($GLOBALS['refid'])) {
                // Nickname in URL, so load the ID
                $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
                array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
@@ -105,8 +100,7 @@ if (isFormSent()) {
        // Begin with doubling process
        if ((REQUEST_ISSET_POST(('userid'))) && (REQUEST_ISSET_POST(('pass'))) && (REQUEST_ISSET_POST(('points')))) {
                // Probe for nickname extension and if a nickname was entered
-               $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round(REQUEST_POST('userid')).'') != REQUEST_POST('userid')));
-               if ($probe_nickname) {
+               if (isNickNameUsed(REQUEST_POST('userid'))) {
                        // Nickname in URL, so load the ID
                        $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
                        array(REQUEST_POST('userid')), __FILE__, __LINE__);
@@ -188,7 +182,7 @@ if (isFormSent()) {
                } elseif (REQUEST_POST('points') > getConfig('doubler_max')) {
                        // Too much points entered
                        define('__ERROR_MSG', getMessage('DOUBLER_FORM_POINTS_MAX'));
-               } elseif ($probe_nickname) {
+               } elseif (isNickNameUsed(REQUEST_POST('userid'))) {
                        // Cannot resolv nickname -> userid
                        define('__ERROR_MSG', getMessage('DOUBLER_FORM_404_NICKNAME'));
                } else {