File renamed to naming convention, ext-repair continued:
authorRoland Häder <roland@mxchange.org>
Tue, 12 Jul 2011 22:44:50 +0000 (22:44 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 12 Jul 2011 22:44:50 +0000 (22:44 +0000)
- gen_refback.php renamed to fix_refsystem.php to make it more clear that this
  script is a) generic and b) is fixing the referal system
- Extension ext-repair: The referal system can now be repaired
- TODOs.txt updated

.gitattributes
DOCS/TODOs.txt
inc/extensions/ext-refback.php
inc/extensions/ext-repair.php
inc/extensions/ext-user.php
inc/fix_refsystem.php [new file with mode: 0644]
inc/gen_refback.php
inc/language/repair_de.php
inc/libs/task_functions.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-repair_refs.php [new file with mode: 0644]

index 3919121..24bca06 100644 (file)
@@ -226,6 +226,7 @@ inc/filter/user_filter.php svneol=native#text/plain
 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_refsystem.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
@@ -554,6 +555,7 @@ inc/modules/admin/what-repair_cats.php svneol=native#text/plain
 inc/modules/admin/what-repair_gmnu.php svneol=native#text/plain
 inc/modules/admin/what-repair_lang.php svneol=native#text/plain
 inc/modules/admin/what-repair_mmnu.php svneol=native#text/plain
+inc/modules/admin/what-repair_refs.php svneol=native#text/plain
 inc/modules/admin/what-send_bonus.php svneol=native#text/plain
 inc/modules/admin/what-send_coupon.php svneol=native#text/plain
 inc/modules/admin/what-send_newsletter.php svneol=native#text/plain
index c24b101..f2d7250 100644 (file)
 ./inc/autopurge/purge-tsks.php:2:// @DEPRECATED
 ./inc/autopurge/purge-unconfirmed.php:2:// @DEPRECATED
 ./inc/daily/daily_engine.php:2:// @DEPRECATED
+./inc/gen_refback.php:2:// @DEPRECATED
 ./inc/loader/load_cache-admin.php:2:// @DEPRECATED
 ./inc/loader/load_cache-config.php:2:// @DEPRECATED
 ./inc/loader/load_cache-extension.php:2:// @DEPRECATED
index 0d6b0c1..1f46156 100644 (file)
@@ -52,7 +52,7 @@ switch (getExtensionMode()) {
                addMemberMenuSql('main', 'refback', 'Ref-Back einstellen', 4);
 
                // Execute this special file on registration
-               addIncludeToPool('extension', 'inc/gen_refback.php');
+               addIncludeToPool('extension', 'inc/fix_refsystem.php');
                break;
 
        case 'remove': // Do stuff when removing extension
index 0bec211..5dd8206 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.1.7');
+setThisExtensionVersion('0.1.8');
 
 // 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'));
+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.8'));
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
@@ -119,6 +119,13 @@ switch (getExtensionMode()) {
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Sprachdateien sind nun auch &quot;reparierbar&quot; - nicht durch das Script, das findet nur die nicht &uuml;bersetzten Zeichenketten, sondern durch den Menschen.");
                                break;
+
+                       case '0.1.8': // SQL queries for v0.1.8
+                               addAdminMenuSql('repair','repair_refs','Referal-Tabelle', 'Setzt die Referal-Tabelle <strong>{?_MYSQL_PREFIX?}_user_refs</strong> zur&uuml;ck und baut diese neu auf. Dies sollten Sie nur tun, falls Ihre Mitglieder Ihnen Probleme mit Referals melden.',6);
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Sprachdateien sind nun auch &quot;reparierbar&quot; - nicht durch das Script, das findet nur die nicht &uuml;bersetzten Zeichenketten, sondern durch den Menschen.");
+                               break;
                } // END - switch
                break;
 
index b34c6bd..4a65c5d 100644 (file)
@@ -472,7 +472,7 @@ INDEX (`refid`)",
                                setExtensionUpdateNotes("Neues Tabellenlayout und verschoben von ext-refback.");
 
                                // Load ext-refback's special include to regenerate the referal table
-                               addIncludeToPool('extension', 'inc/gen_refback.php');
+                               addIncludeToPool('extension', 'inc/fix_refsystem.php');
                                break;
                } // END - switch
                break;
diff --git a/inc/fix_refsystem.php b/inc/fix_refsystem.php
new file mode 100644 (file)
index 0000000..8608d51
--- /dev/null
@@ -0,0 +1,89 @@
+<?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        *
+ * -------------------------------------------------------------------- *
+ * $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
+
+// Sanity-check: Do we have ref level 0?
+$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0 OR `level` IS NULL', __FILE__, __LINE__);
+if (!SQL_HASZERONUMS($result)) {
+       // Remove index temporaly
+       SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__);
+
+       // Upgrade refsystem, ref-level 0 is silly here
+       SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__);
+
+       // Add it again
+       SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`, `level` )', __FILE__, __LINE__);
+
+       // Rebuild cache
+       rebuildCache('refsystem', 'refsystem');
+} // END - if
+
+// Free result
+SQL_FREERESULT($result);
+
+// Reset the table
+SQL_QUERY('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__);
+
+// Begin with all users in level one
+$result_direct = SQL_QUERY('SELECT
+       `userid`
+FROM
+       `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+       `refid`=0 OR `refid` IS NULL
+ORDER BY
+       `userid` ASC', __FILE__, __LINE__);
+
+// Do we have entries?
+if (!SQL_HASZERONUMS($result_direct)) {
+       // When 'walk' through all users
+       while ($content = SQL_FETCHARRAY($result_direct)) {
+               // Update refback table
+               //* DEBUG: */ debugOutput('userid=' . $content['userid']);
+               updateReferalTable($content['userid']);
+       } // END - while
+} // END - if
+
+// Free result
+SQL_FREERESULT($result_direct);
+
+// [EOF]
+?>
index fa4a874..f551ef4 100644 (file)
@@ -1,89 +1,3 @@
 <?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 09/27/2008 *
- * ===================                          Last change: 09/27/2008 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : gen_refback.php                                  *
- * -------------------------------------------------------------------- *
- * Short description : Generate refback table including all refs        *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Refback-Tabelle mit allen Refs generieren        *
- * -------------------------------------------------------------------- *
- * $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
-
-// Sanity-check: Do we have ref level 0?
-$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0 OR `level` IS NULL', __FILE__, __LINE__);
-if (!SQL_HASZERONUMS($result)) {
-       // Remove index temporaly
-       SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__);
-
-       // Upgrade refsystem, ref-level 0 is silly here
-       SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__);
-
-       // Add it again
-       SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`, `level` )', __FILE__, __LINE__);
-
-       // Rebuild cache
-       rebuildCache('refsystem', 'refsystem');
-} // END - if
-
-// Free result
-SQL_FREERESULT($result);
-
-// Reset the table
-SQL_QUERY('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__);
-
-// Begin with all users in level one
-$result_direct = SQL_QUERY('SELECT
-       `userid`
-FROM
-       `{?_MYSQL_PREFIX?}_user_data`
-WHERE
-       `refid`=0
-ORDER BY
-       `userid` ASC', __FILE__, __LINE__);
-
-// Do we have entries?
-if (!SQL_HASZERONUMS($result_direct)) {
-       // When 'walk' through all users
-       while ($content = SQL_FETCHARRAY($result_direct)) {
-               // Update refback table
-               //* DEBUG: */ debugOutput('userid=' . $content['userid']);
-               updateReferalTable($content['userid']);
-       } // END - while
-} // END - if
-
-// Free result
-SQL_FREERESULT($result_direct);
-
-// [EOF]
+// @DEPRECATED
 ?>
index 78d3b10..426f030 100644 (file)
@@ -47,6 +47,7 @@ addMessages(array(
        'ADMIN_REPAIR_NOTHING_FIXED' => "Es wurden keine Eintr&auml;ge repariert.",
        'ADMIN_REPAIR_LANGUAGE_TO_MUCH' => "Es sind mehr als 100 nicht existierende Elemente in der Zielsprachdatei gefunden worden.",
        'ADMIN_REPAIR_LANGUAGE_TITLE' => "Analyse an den Sprachdateien",
+       'ADMIN_REPAIR_REFERAL_SYSTEM_DONE' => "Das Referal-System wurde zur&uuml;ckgesetzt und neu aufgebaut.",
 ));
 
 // [EOF]
index 13ddfd2..47d9f1c 100644 (file)
@@ -274,7 +274,7 @@ ORDER BY
 
        if ((isExtensionInstalledAndNewer('sql_patches', '0.3.4')) && (isExtensionActive('user'))) {
                // Check for accounts without referal
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `refid`=0 ORDER BY `userid` ASC");
+               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `refid`=0 OR `refid` IS NULL ORDER BY `userid` ASC");
                $DESCRs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NOREF--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NOREFERAL_TITLE--}';
                $WHATs[]  = 'list_user&amp;mode=norefs';
index b330b66..0c86176 100644 (file)
@@ -188,20 +188,20 @@ LIMIT 1",
                        case 'norefs': // Users w/o refs
                                if (!empty($whereStatement)) {
                                        // Add AND statement
-                                       $whereStatement .= " AND `refid`=0";
+                                       $whereStatement .= ' AND (`refid`=0 OR `refid` IS NULL)';
                                } else {
                                        // Add WHERE statement
-                                       $whereStatement = " WHERE `refid`=0";
+                                       $whereStatement = ' WHERE (`refid`=0 OR `refid` IS NULL)';
                                }
                                break;
 
                        case 'random_refid': // Users available for random referal id
                                if (!empty($whereStatement)) {
                                        // Add AND statement
-                                       $whereStatement .= " AND `rand_confirmed` >= {?user_min_confirmed?}";
+                                       $whereStatement .= ' AND `rand_confirmed` >= {?user_min_confirmed?}';
                                } else {
                                        // Add WHERE statement
-                                       $whereStatement = " WHERE `rand_confirmed` >= {?user_min_confirmed?}";
+                                       $whereStatement = ' WHERE `rand_confirmed` >= {?user_min_confirmed?}';
                                }
                                break;
 
diff --git a/inc/modules/admin/what-repair_refs.php b/inc/modules/admin/what-repair_refs.php
new file mode 100644 (file)
index 0000000..fd567dd
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 07/13/2011 *
+ * ===================                          Last change: 07/13/2011 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-repair_refs.php                             *
+ * -------------------------------------------------------------------- *
+ * Short description : "Repairs" the referal system                     *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : "Repariert" das Referal-System                   *
+ * -------------------------------------------------------------------- *
+ * $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')) || (!isAdmin())) {
+       die();
+} // END - if
+
+// Add description as navigation point
+addYouAreHereLink('admin', __FILE__);
+
+// Just include fix_refsystem.php again
+loadIncludeOnce('inc/fix_refsystem.php');
+
+// Output message
+displayMessage('{--ADMIN_REPAIR_REFERAL_SYSTEM_DONE--}');
+
+// [EOF]
+?>