inc/filters.php svneol=native#text/plain
inc/fix_filters.php svneol=native#text/plain
inc/fix_menu.php svneol=native#text/plain
+inc/fix_user_points.php svneol=native#text/plain
inc/footer.php svneol=native#text/plain
inc/functions.php svneol=native#text/plain
inc/gen_mediadata.php svneol=native#text/plain
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')",
array(
getUserData('userid'),
- makeDatabaseUserId(determineReferalId()),
+ makeZeroToNull(determineReferalId()),
bigintval(postRequestParameter('points') * 2),
detectRemoteAddr()
), __FILE__, __LINE__);
// Okay add a refid line and apply refid percents
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')",
array(
- makeDatabaseUserId(determineReferalId()),
+ makeZeroToNull(determineReferalId()),
(postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100),
detectRemoteAddr()
), __FILE__, __LINE__);
} // END - if
// Version number
-setThisExtensionVersion('0.3.9');
+setThisExtensionVersion('0.4.0');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0'));
// Keep this extension always active!
setExtensionAlwaysActive('Y');
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Filter registriert, die das eigene {?POINTS?}-Guthaben des Mitgliedes zurückliefern.");
break;
+
+ case '0.4.0': // SQL queries for v0.4.0
+ // Add special fix include to fix filters
+ addIncludeToPool('extension', 'inc/fix_user_points.php');
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Das Mitgliederguthaben musste repariert werden, da für Referal-Ebene 0, noch NULL geschrieben wurde.");
+ break;
} // END - switch
break;
getModule(),
$action,
getWhat(),
- makeDatabaseUserId($userid),
- makeDatabaseUserId(determineReferalId()),
+ makeZeroToNull($userid),
+ makeZeroToNull(determineReferalId()),
$isMember,
$isAdmin,
detectRemoteAddr(),
getModule(),
$action,
getWhat(),
- makeDatabaseUserId($userid),
- makeDatabaseUserId(determineReferalId()),
+ makeZeroToNull($userid),
+ makeZeroToNull(determineReferalId()),
$isMember,
$isAdmin,
session_id(),
--- /dev/null
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 07/04/2011 *
+ * =================== Last change: 07/04/2011 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : fix_user_points.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Fixes dublicate entries in user_points table *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Repariert doppelte Eintraege in user_points *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ die();
+} // END - if
+
+// Get all user points
+$result = SQL_QUERY('SELECT
+ `userid`, `points`
+FROM
+ `{?_MYSQL_PREFIX?}_user_points`
+WHERE
+ `ref_depth`=0
+ORDER BY
+ `userid` ASC', __FILE__, __LINE__);
+
+// Do we have entries? (we should have!)
+if (!SQL_HASZERONUMS($result)) {
+ // Load row by row
+ while ($row = SQL_FETCHARRAY($result)) {
+ // We have to fix this amount, so first pay it directly
+ addPointsDirectly('user_null_fix', $row['userid'], $row['points']);
+ } // END - while
+} // END - if
+
+// Free result
+SQL_FREERESULT($result);
+
+// Remove all entries
+SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `ref_depth`=0', __FILE__, __LINE__);
+
+// [EOF]
+?>
}
// Converts a userid so it can be used in SQL queries
-function makeDatabaseUserId ($userid) {
+function makeZeroToNull ($number) {
// Is it a valid username?
- if (isValidUserId($userid)) {
+ if ((!is_null($number)) && ($number > 0)) {
// Always secure it
- $userid = bigintval($userid);
+ $number = bigintval($number);
} else {
// Is not valid or zero
- $userid = 'NULL';
+ $number = 'NULL';
}
// Return it
- return $userid;
+ return $number;
}
// Capitalizes a string with underscores, e.g.: some_foo_string will become SomeFooString
generateHash(postRequestParameter('pass1')),
bigintval(postRequestParameter('max_mails')),
bigintval(postRequestParameter('max_mails')),
- makeDatabaseUserId(postRequestParameter('refid')),
+ makeZeroToNull(postRequestParameter('refid')),
$hash,
detectRemoteAddr(),
), __FUNCTION__, __LINE__);
if (!isset($GLOBALS['ref_level'])) {
// Initialialize referal system
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ' Referal system initialized!');
- $GLOBALS['ref_level'] = '0';
+ $GLOBALS['ref_level'] = NULL;
} else {
// Increase referal level
$GLOBALS['ref_level']++;
$pointsColumn,
$ref_points,
bigintval($userid),
- bigintval($GLOBALS['ref_level'])
+ makeZeroToNull($GLOBALS['ref_level'])
), __FUNCTION__, __LINE__);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$addMode.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
array(
$pointsColumn,
bigintval($userid),
- bigintval($GLOBALS['ref_level']),
+ makeZeroToNull($GLOBALS['ref_level']),
$ref_points
), __FUNCTION__, __LINE__);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$addMode.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
if ((isExtensionActive('user')) && (isReferalIdValid()) && (isValidUserId(determineReferalId()))) {
// Update ref counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
- array(makeDatabaseUserId(determineReferalId())), __FILE__, __LINE__);
+ array(makeZeroToNull(determineReferalId())), __FILE__, __LINE__);
// Base URL for redirection
switch (getConfig('refid_target')) {