Moved "fix" files (which only helps to fix stuff) in own inc/fixes/ folder.
authorRoland Haeder <roland@mxchange.org>
Mon, 28 Mar 2016 16:07:19 +0000 (18:07 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 28 Mar 2016 16:07:19 +0000 (18:07 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
17 files changed:
inc/extensions/ext-menu.php
inc/extensions/ext-refback.php
inc/extensions/ext-user.php
inc/extensions/sql_patches/mode-update.php
inc/extensions/user/mode-update.php
inc/fix_filters.php [deleted file]
inc/fix_menu.php [deleted file]
inc/fix_refsystem.php [deleted file]
inc/fix_user_points.php [deleted file]
inc/fixes/.htaccess [new file with mode: 0644]
inc/fixes/fix_ [new file with mode: 0644]
inc/fixes/fix_filters.php [new file with mode: 0644]
inc/fixes/fix_menu.php [new file with mode: 0644]
inc/fixes/fix_refsystem.php [new file with mode: 0644]
inc/fixes/fix_user_points.php [new file with mode: 0644]
inc/libs/user_functions.php
inc/modules/admin/what-repair_refs.php

index 8e2b727..21fae0b 100644 (file)
@@ -93,7 +93,7 @@ switch (getExtensionMode()) {
 
                        case '0.0.2': // SQL queries for v0.0.2
                                // Load the fix include
-                               addIncludeToPool('extension', 'inc/fix_menu.php');
+                               addIncludeToPool('extension', 'inc/fixes/fix_menu.php');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Doppelte Men&uuml;punkte bereinigt.");
index 9a89d6c..16d9f15 100644 (file)
@@ -53,7 +53,7 @@ switch (getExtensionMode()) {
                addMemberMenuSql('main', 'reflist', 'Ref-&Uuml;bersicht', 5);
 
                // Execute this special file on registration
-               addIncludeToPool('extension', 'inc/fix_refsystem.php');
+               addIncludeToPool('extension', 'inc/fixes/fix_refsystem.php');
                break;
 
        case 'remove': // Do stuff when removing extension
index 529886d..5e5557a 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.6.2');
+setThisExtensionVersion('0.6.3');
 
 // 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.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', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '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', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
index 74f48b1..12f05d7 100644 (file)
@@ -572,7 +572,7 @@ UNIQUE INDEX `name_function` (`filter_name`, `filter_function`)",
                                setExtensionUpdateNotes("Filter-Tabelle bereinigt um doppelte Eintr&auml;ge und Unique-Key auf <span class=\"bad\">filter_name</span> und <span class=\"bad\">filter_function</span> zusammen gesetzt.");
 
                                // Add special fix include to fix filters
-                               addIncludeToPool('extension', 'inc/fix_filters.php');
+                               addIncludeToPool('extension', 'inc/fixes/fix_filters.php');
                                break;
 
                        case '0.6.4': // SQL queries for v0.6.4
index 25c42c3..ee6a940 100644 (file)
@@ -267,7 +267,7 @@ INDEX (`userid`)",
 
                        case '0.4.1': // SQL queries for v0.4.1
                                // Add special fix include to fix filters
-                               addIncludeToPool('extension', 'inc/fix_user_points.php');
+                               addIncludeToPool('extension', 'inc/fixes/fix_user_points.php');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Das Mitgliederguthaben musste repariert werden, da f&uuml;r Referral-Ebene 0, noch NULL geschrieben wurde.");
@@ -303,7 +303,7 @@ INDEX (`refid`)",
                                        'User referrals');
 
                                // Load ext-refback's special include to regenerate the referral table
-                               addIncludeToPool('extension', 'inc/fix_refsystem.php');
+                               addIncludeToPool('extension', 'inc/fixes/fix_refsystem.php');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Neues Tabellenlayout und verschoben von ext-refback.");
@@ -557,6 +557,14 @@ PRIMARY KEY (`provider_id`)",
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter f&uuml;r das Handling der Loginanfragen hinzuge&uuml;gt.");
                                break;
+
+                       case '0.6.3': // SQL queries for v0.6.3
+                               addExtensionAddTableColumnSql('user_data', 'confirmed_timestamp', 'TIMESTAMP NULL DEFAULT NULL');
+                               addExtensionAddTableColumnSql('user_data', 'confirmed_ip_address', 'VARCHAR(255) NULL DEFAULT NULL');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Spalten f&uuml;r Best&auml;tigungszeitpunkt und IP-Adresse hinzugef&uuml;gt.");
+                               break;
                } // END - switch
 
 // [EOF]
diff --git a/inc/fix_filters.php b/inc/fix_filters.php
deleted file mode 100644 (file)
index 040333f..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 10/06/2009 *
- * ===================                          Last change: 10/06/2009 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : fix_filters.php                                  *
- * -------------------------------------------------------------------- *
- * Short description : Fixes dublicate entries in filters table         *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Repariert doppelte Eintraege in filters-Tabelle  *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
- * For more information visit: http://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 filters
-$result = sqlQuery('SELECT
-       `filter_name`,
-       `filter_function`
-FROM
-       `{?_MYSQL_PREFIX?}_filters`
-ORDER BY
-       `filter_name` ASC,
-       `filter_function` ASC', __FILE__, __LINE__);
-
-// Are there entries? (there should be!)
-if (!ifSqlHasZeroNumRows($result)) {
-       // Load row by row
-       while ($filter = sqlFetchArray($result)) {
-               // Now search again for this filter and get it's total count
-               $count = countSumTotalData($filter['filter_name'], 'filters', 'filter_id', 'filter_name', TRUE, sprintf(" AND `filter_function`='%s'", sqlEscapeString($filter['filter_function'])));
-
-               // Is there more than one entry?
-               if ($count > 1) {
-                       // Then clean them up, except one
-                       addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_filters` WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT %s",
-                               array($filter['filter_name'], $filter['filter_function'], ($count - 1)));
-               } // END - while
-       } // END - while
-
-       // Rebuild the cache
-       rebuildCache('filter', 'filter');
-} // END - if
-
-// Free result
-sqlFreeResult($result);
-
-// Now insert our unqiue key
-addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_filters` DROP KEY `name_function`');
-addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_filters` ADD UNIQUE INDEX `name_function` (`filter_name`, `filter_function`)');
-
-// [EOF]
-?>
diff --git a/inc/fix_menu.php b/inc/fix_menu.php
deleted file mode 100644 (file)
index 16a328b..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 10/22/2009 *
- * ===================                          Last change: 10/22/2009 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : fix_menu.php                                     *
- * -------------------------------------------------------------------- *
- * Short description : Fixes dublicate entries in filters table         *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Repariert doppelte Eintraege in filters-Tabelle  *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
- * For more information visit: http://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 menus
-foreach (array('guest','member','admin') as $menu) {
-       // Query it
-       $result = sqlQueryEscaped("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC",
-               array($menu), __FILE__, __LINE__);
-
-       // Init array
-       $menus = array();
-
-       // Load all entries
-       while ($entry = sqlFetchArray($result)) {
-               // Is the menu entry set?
-               if (!isset($menus['menu'][$entry['action']][$entry['what']])) {
-                       // Not found
-                       $menus['menu'][$entry['action']][$entry['what']] = 1;
-               } else {
-                       // Double entry, so get count
-                       if (is_null($entry['what'])) {
-                               // Main menu
-                               $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, ' AND `what` IS NULL');
-                       } else {
-                               // Sub menu
-                               $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, sprintf(" AND `what`='%s'", $entry['what']));
-                       }
-                       //* DEBUG: */ debugOutput('menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries);
-
-                       // Only remove if we have at least 2 entries from same menu
-                       if ($entries > 1) {
-                               // Remove all except one
-                               if (is_null($entry['what'])) {
-                                       // Main menu is double
-                                       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s",
-                                               array(
-                                                       $menu,
-                                                       $entry['action'],
-                                                       ($entries - 1)
-                                               ), __FILE__, __LINE__);
-                               } else {
-                                       // Sub menu is double
-                                       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s",
-                                               array(
-                                                       $menu,
-                                                       $entry['action'],
-                                                       $entry['what'],
-                                                       ($entries - 1)
-                                               ), __FILE__, __LINE__);
-                               }
-                       } // END - if
-               }
-       } // END - while
-
-       // Free result
-       sqlFreeResult($result);
-
-       // Init sqls
-       initSqls();
-
-       // Now insert our unqiue key for action-what combination
-       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP INDEX `action_what`', $menu));
-       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `action_what` (`action`, `what`)', $menu));
-
-       // Now insert our unqiue key for what
-       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP INDEX `what`', $menu));
-       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `what` (`what`)', $menu));
-
-       // And run all
-       runFilterChain('run_sqls');
-} // END - foreach
-
-// [EOF]
-?>
diff --git a/inc/fix_refsystem.php b/inc/fix_refsystem.php
deleted file mode 100644 (file)
index 566f03f..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 07/13/2011 *
- * ===================                          Last change: 07/13/2011 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : fix_refsystem.php                                *
- * -------------------------------------------------------------------- *
- * Short description : Generate refback table including all refs        *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Refback-Tabelle mit allen Refs generieren        *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
- * For more information visit: http://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
-
-// Sanity-check: Is there ref level 0? If so, this must be fixed to NULL and `level` must be increased by one
-$result = sqlQuery('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__);
-if (!ifSqlHasZeroNumRows($result)) {
-       // Remove index temporaly
-       sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__);
-
-       // Upgrade refsystem
-       sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__);
-
-       // Add it again
-       sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE INDEX `userid_level` (`userid`, `level`)', __FILE__, __LINE__);
-
-       // Rebuild cache
-       rebuildCache('refsystem', 'refsystem');
-} // END - if
-
-// Free result
-sqlFreeResult($result);
-
-// Reset the table
-sqlQuery('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__);
-
-// Begin with all users in level one
-$result_direct = sqlQuery('SELECT
-       `userid`
-FROM
-       `{?_MYSQL_PREFIX?}_user_data`
-WHERE
-       `refid`=0 OR
-       `refid` IS NULL
-ORDER BY
-       `userid` ASC', __FILE__, __LINE__);
-
-// Are there entries?
-if (!ifSqlHasZeroNumRows($result_direct)) {
-       // When 'walk' through all users
-       while ($content = sqlFetchArray($result_direct)) {
-               // Update refback table
-               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'userid=' . $content['userid'] . ' - BEFORE!');
-               updateReferralTable($content['userid']);
-               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'userid=' . $content['userid'] . ' - AFTER!');
-       } // END - while
-} // END - if
-
-// Free result
-sqlFreeResult($result_direct);
-
-// [EOF]
-?>
diff --git a/inc/fix_user_points.php b/inc/fix_user_points.php
deleted file mode 100644 (file)
index a070afa..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?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      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
- * For more information visit: http://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 = sqlQuery('SELECT
-       `userid`,
-       `points`,
-       `locked_points`,
-       `order_points`,
-       `locked_order_points`
-FROM
-       `{?_MYSQL_PREFIX?}_user_points`
-WHERE
-       `ref_depth`=0
-ORDER BY
-       `userid` ASC', __FILE__, __LINE__);
-
-// Are there entries? (there should be!)
-if (!ifSqlHasZeroNumRows($result)) {
-       // Load row by row
-       while ($row = sqlFetchArray($result)) {
-               // Update the database again
-               foreach (array_keys($row) as $column) {
-                       // Not userid itself
-                       if ($column != 'userid') {
-                               // Update amount
-                               sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth` IS NULL",
-                                       array(
-                                               $column,
-                                               $column,
-                                               $row[$column],
-                                               $row['userid']
-                                       ), __FILE__, __LINE__);
-
-                               // Nothing has been updated?
-                               if (ifSqlHasZeroAffectedRows()) {
-                                       // Then insert it
-                                       sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,NULL,%s)",
-                                               array(
-                                                       $column,
-                                                       $row['userid'],
-                                                       $row[$column]
-                                               ), __FILE__, __LINE__);
-                               } // END - if
-                       } // END - if
-               } // END - foreach
-       } // END - while
-} // END - if
-
-// Free result
-sqlFreeResult($result);
-
-// Remove all entries
-sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `ref_depth`=0', __FILE__, __LINE__);
-
-// [EOF]
-?>
diff --git a/inc/fixes/.htaccess b/inc/fixes/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/fixes/fix_ b/inc/fixes/fix_
new file mode 100644 (file)
index 0000000..9f2df72
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 03/28/2016 *
+ * ===================                          Last change: 03/28/2016 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : fix_                                             *
+ * -------------------------------------------------------------------- *
+ * Short description : Fixes                                            *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Repariert                                        *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://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
+
+// [EOF]
+?>
diff --git a/inc/fixes/fix_filters.php b/inc/fixes/fix_filters.php
new file mode 100644 (file)
index 0000000..040333f
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/06/2009 *
+ * ===================                          Last change: 10/06/2009 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : fix_filters.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Fixes dublicate entries in filters table         *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Repariert doppelte Eintraege in filters-Tabelle  *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://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 filters
+$result = sqlQuery('SELECT
+       `filter_name`,
+       `filter_function`
+FROM
+       `{?_MYSQL_PREFIX?}_filters`
+ORDER BY
+       `filter_name` ASC,
+       `filter_function` ASC', __FILE__, __LINE__);
+
+// Are there entries? (there should be!)
+if (!ifSqlHasZeroNumRows($result)) {
+       // Load row by row
+       while ($filter = sqlFetchArray($result)) {
+               // Now search again for this filter and get it's total count
+               $count = countSumTotalData($filter['filter_name'], 'filters', 'filter_id', 'filter_name', TRUE, sprintf(" AND `filter_function`='%s'", sqlEscapeString($filter['filter_function'])));
+
+               // Is there more than one entry?
+               if ($count > 1) {
+                       // Then clean them up, except one
+                       addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_filters` WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT %s",
+                               array($filter['filter_name'], $filter['filter_function'], ($count - 1)));
+               } // END - while
+       } // END - while
+
+       // Rebuild the cache
+       rebuildCache('filter', 'filter');
+} // END - if
+
+// Free result
+sqlFreeResult($result);
+
+// Now insert our unqiue key
+addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_filters` DROP KEY `name_function`');
+addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_filters` ADD UNIQUE INDEX `name_function` (`filter_name`, `filter_function`)');
+
+// [EOF]
+?>
diff --git a/inc/fixes/fix_menu.php b/inc/fixes/fix_menu.php
new file mode 100644 (file)
index 0000000..16a328b
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/22/2009 *
+ * ===================                          Last change: 10/22/2009 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : fix_menu.php                                     *
+ * -------------------------------------------------------------------- *
+ * Short description : Fixes dublicate entries in filters table         *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Repariert doppelte Eintraege in filters-Tabelle  *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://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 menus
+foreach (array('guest','member','admin') as $menu) {
+       // Query it
+       $result = sqlQueryEscaped("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC",
+               array($menu), __FILE__, __LINE__);
+
+       // Init array
+       $menus = array();
+
+       // Load all entries
+       while ($entry = sqlFetchArray($result)) {
+               // Is the menu entry set?
+               if (!isset($menus['menu'][$entry['action']][$entry['what']])) {
+                       // Not found
+                       $menus['menu'][$entry['action']][$entry['what']] = 1;
+               } else {
+                       // Double entry, so get count
+                       if (is_null($entry['what'])) {
+                               // Main menu
+                               $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, ' AND `what` IS NULL');
+                       } else {
+                               // Sub menu
+                               $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, sprintf(" AND `what`='%s'", $entry['what']));
+                       }
+                       //* DEBUG: */ debugOutput('menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries);
+
+                       // Only remove if we have at least 2 entries from same menu
+                       if ($entries > 1) {
+                               // Remove all except one
+                               if (is_null($entry['what'])) {
+                                       // Main menu is double
+                                       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s",
+                                               array(
+                                                       $menu,
+                                                       $entry['action'],
+                                                       ($entries - 1)
+                                               ), __FILE__, __LINE__);
+                               } else {
+                                       // Sub menu is double
+                                       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s",
+                                               array(
+                                                       $menu,
+                                                       $entry['action'],
+                                                       $entry['what'],
+                                                       ($entries - 1)
+                                               ), __FILE__, __LINE__);
+                               }
+                       } // END - if
+               }
+       } // END - while
+
+       // Free result
+       sqlFreeResult($result);
+
+       // Init sqls
+       initSqls();
+
+       // Now insert our unqiue key for action-what combination
+       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP INDEX `action_what`', $menu));
+       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `action_what` (`action`, `what`)', $menu));
+
+       // Now insert our unqiue key for what
+       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP INDEX `what`', $menu));
+       addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `what` (`what`)', $menu));
+
+       // And run all
+       runFilterChain('run_sqls');
+} // END - foreach
+
+// [EOF]
+?>
diff --git a/inc/fixes/fix_refsystem.php b/inc/fixes/fix_refsystem.php
new file mode 100644 (file)
index 0000000..566f03f
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 07/13/2011 *
+ * ===================                          Last change: 07/13/2011 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : fix_refsystem.php                                *
+ * -------------------------------------------------------------------- *
+ * Short description : Generate refback table including all refs        *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Refback-Tabelle mit allen Refs generieren        *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://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
+
+// Sanity-check: Is there ref level 0? If so, this must be fixed to NULL and `level` must be increased by one
+$result = sqlQuery('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__);
+if (!ifSqlHasZeroNumRows($result)) {
+       // Remove index temporaly
+       sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__);
+
+       // Upgrade refsystem
+       sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__);
+
+       // Add it again
+       sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE INDEX `userid_level` (`userid`, `level`)', __FILE__, __LINE__);
+
+       // Rebuild cache
+       rebuildCache('refsystem', 'refsystem');
+} // END - if
+
+// Free result
+sqlFreeResult($result);
+
+// Reset the table
+sqlQuery('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__);
+
+// Begin with all users in level one
+$result_direct = sqlQuery('SELECT
+       `userid`
+FROM
+       `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+       `refid`=0 OR
+       `refid` IS NULL
+ORDER BY
+       `userid` ASC', __FILE__, __LINE__);
+
+// Are there entries?
+if (!ifSqlHasZeroNumRows($result_direct)) {
+       // When 'walk' through all users
+       while ($content = sqlFetchArray($result_direct)) {
+               // Update refback table
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'userid=' . $content['userid'] . ' - BEFORE!');
+               updateReferralTable($content['userid']);
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'userid=' . $content['userid'] . ' - AFTER!');
+       } // END - while
+} // END - if
+
+// Free result
+sqlFreeResult($result_direct);
+
+// [EOF]
+?>
diff --git a/inc/fixes/fix_user_points.php b/inc/fixes/fix_user_points.php
new file mode 100644 (file)
index 0000000..a070afa
--- /dev/null
@@ -0,0 +1,91 @@
+<?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      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://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 = sqlQuery('SELECT
+       `userid`,
+       `points`,
+       `locked_points`,
+       `order_points`,
+       `locked_order_points`
+FROM
+       `{?_MYSQL_PREFIX?}_user_points`
+WHERE
+       `ref_depth`=0
+ORDER BY
+       `userid` ASC', __FILE__, __LINE__);
+
+// Are there entries? (there should be!)
+if (!ifSqlHasZeroNumRows($result)) {
+       // Load row by row
+       while ($row = sqlFetchArray($result)) {
+               // Update the database again
+               foreach (array_keys($row) as $column) {
+                       // Not userid itself
+                       if ($column != 'userid') {
+                               // Update amount
+                               sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth` IS NULL",
+                                       array(
+                                               $column,
+                                               $column,
+                                               $row[$column],
+                                               $row['userid']
+                                       ), __FILE__, __LINE__);
+
+                               // Nothing has been updated?
+                               if (ifSqlHasZeroAffectedRows()) {
+                                       // Then insert it
+                                       sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,NULL,%s)",
+                                               array(
+                                                       $column,
+                                                       $row['userid'],
+                                                       $row[$column]
+                                               ), __FILE__, __LINE__);
+                               } // END - if
+                       } // END - if
+               } // END - foreach
+       } // END - while
+} // END - if
+
+// Free result
+sqlFreeResult($result);
+
+// Remove all entries
+sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `ref_depth`=0', __FILE__, __LINE__);
+
+// [EOF]
+?>
index f20c7f3..5c0dcb4 100644 (file)
@@ -596,10 +596,30 @@ function doConfirmUserAccount ($hash) {
        } // END - if
 
        // Load all data and add points
-       $content = getUserDataArray();
+       $content = merge_array($content, getUserDataArray());
 
-       // Unlock his account (but only when it is on UNCONFIRMED!)
-       sqlQueryEscaped("UPDATE
+       // Is 'user' updated?
+       if (isExtensionInstalledAndNewer('user', '0.6.3')) {
+               // Unlock his account (but only when it is on UNCONFIRMED!)
+               sqlQueryEscaped("UPDATE
+       `{?_MYSQL_PREFIX?}_user_data`
+SET
+       `status`='CONFIRMED',
+       `user_hash`=NULL,
+       `confirmed_timestamp`=NOW(),
+       `confirmed_ip_address`='%s'
+WHERE
+       `user_hash`='%s' AND
+       `status`='UNCONFIRMED'
+LIMIT 1",
+                       array(
+                               determineRealRemoteAddress(),
+                               $hash
+                       ), __FILE__, __LINE__
+               );
+       } else {
+               // Unlock his account (but only when it is on UNCONFIRMED!)
+               sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_user_data`
 SET
        `status`='CONFIRMED',
@@ -608,7 +628,11 @@ WHERE
        `user_hash`='%s' AND
        `status`='UNCONFIRMED'
 LIMIT 1",
-               array($hash), __FILE__, __LINE__);
+                       array(
+                               $hash
+                       ), __FILE__, __LINE__
+               );
+       }
 
        // Was it updated?
        if (ifSqlHasZeroAffectedRows()) {
index b77436b..f761b4d 100644 (file)
@@ -51,7 +51,7 @@ if (isExtensionInstalledAndOlder('user', '0.4.4')) {
 } // END - if
 
 // Just include fix_refsystem.php again
-loadIncludeOnce('inc/fix_refsystem.php');
+loadIncludeOnce('inc/fixes/fix_refsystem.php');
 
 // Output message
 displayMessage('{--ADMIN_REPAIR_REFERRAL_SYSTEM_DONE--}');