Some minor rewrites, addPointsAutoPurge() now validates the userid before executing...
authorRoland Häder <roland@mxchange.org>
Wed, 25 Aug 2010 21:09:35 +0000 (21:09 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 25 Aug 2010 21:09:35 +0000 (21:09 +0000)
inc/libs/autopurge_functions.php
inc/wrapper-functions.php
lead-confirm.php

index 176e6e40c43ed5f846cee239e7093b99d834e203..8843c5614508f50b4f3f3aa12b06af9a09179d70 100644 (file)
@@ -44,6 +44,12 @@ if (!defined('__SECURITY')) {
 
 // Add points in autopurge-mode
 function addPointsAutoPurge ($userid, $points) {
+       // Is the userid valid?
+       if (!isValidUserId($userid)) {
+               // Please report all these bugs
+               debug_report_bug(__FUNCTION__, __LINE__, 'Invalid call. userid=' . $userid . ',points=' . $points);
+       } // END - if
+
        // Add points over the ref system directly now
        addPointsDirectly('autopurge_add', $userid, $points);
 
index 7480bb4cf9aaf48f43df58e007bb23f72690243a..da04d5ddccea5a9bacc6f1abb70f6daa2f6431a0 100644 (file)
@@ -807,7 +807,7 @@ function initUserData () {
        // User id should not be zero
        if (!isValidUserId(getCurrentUserId())) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
        } // END - if
 
        // Init the user
@@ -819,7 +819,7 @@ function getUserData ($column) {
        // User id should not be zero
        if (!isValidUserId(getCurrentUserId())) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
        } // END - if
 
        // Return the value
@@ -834,7 +834,7 @@ function getUserDataArray () {
        // Is the current userid valid?
        if (!isValidUserId($userid)) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is invalid.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . $userid);
        } // END - if
 
        // Get the whole array if found
index 65a1ecfa7c75f2c704694dcd6903799003533f9e..4c179e831c0188bc175210c9087e5c53fd30ba17 100644 (file)
@@ -63,27 +63,18 @@ loadIncludeOnce('inc/header.php');
 
 // Initialize the array for the template
 $content = array(
-       'lead_userid'   => -1,
-       'lead_email' => 'INVALID@EMAIL'
+       'lead_userid' => '0',
+       'lead_email'  => '{?WEBMASTER?}'
 );
 
 // Is the cookie set?
-if (isSessionVariableSet('lead_userid')) {
-       // Is the user-account unlocked and valid?
-       if (fetchUserData(getSession('lead_userid'))) {
-               // Secure the id number
-               $content['lead_userid'] = bigintval(getSession('lead_userid'));
+if ((isSessionVariableSet('lead_userid')) && (fetchUserData(getSession('lead_userid')))) {
+       // Secure the id number
+       $content['lead_userid'] = bigintval(getSession('lead_userid'));
 
-               // Load the email address
-               $content['lead_email'] = getUserData('email');
-       } else {
-               // Not found!
-               $content['lead_userid'] = '0';
-       }
-} else {
-       // Maybe spider?
-       $content['lead_email'] = getConfig('WEBMASTER');
-}
+       // Load the email address
+       $content['lead_email'] = getUserData('email');
+} // END - if
 
 // Load the lead template
 loadTemplate('lead_code', false, $content);