]> git.mxchange.org Git - mailer.git/commitdiff
Refback extension in alpha phase finished, users can give refback to all refs in...
authorRoland Häder <roland@mxchange.org>
Mon, 29 Sep 2008 22:38:31 +0000 (22:38 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 29 Sep 2008 22:38:31 +0000 (22:38 +0000)
109 files changed:
.gitattributes
inc/databases.php
inc/db/lib-mysql3.php
inc/extensions.php
inc/extensions/ext-active.php
inc/extensions/ext-admins.php
inc/extensions/ext-admintheme1.php
inc/extensions/ext-admintheme_default.php
inc/extensions/ext-bank.php
inc/extensions/ext-beg.php
inc/extensions/ext-birthday.php
inc/extensions/ext-bonus.php
inc/extensions/ext-cache.php
inc/extensions/ext-demo.php
inc/extensions/ext-doubler.php
inc/extensions/ext-holiday.php
inc/extensions/ext-html_mail.php
inc/extensions/ext-mailid.php
inc/extensions/ext-mods.php
inc/extensions/ext-mydata.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-nickname.php
inc/extensions/ext-online.php
inc/extensions/ext-order.php
inc/extensions/ext-payout.php
inc/extensions/ext-primera.php
inc/extensions/ext-profile.php
inc/extensions/ext-rallye.php
inc/extensions/ext-refback.php [new file with mode: 0644]
inc/extensions/ext-register.php
inc/extensions/ext-repair.php
inc/extensions/ext-rewrite.php
inc/extensions/ext-safe.php
inc/extensions/ext-sponsor.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-support.php
inc/extensions/ext-surfbar.php
inc/extensions/ext-task.php
inc/extensions/ext-theme.php
inc/extensions/ext-top10.php
inc/extensions/ext-transfer.php
inc/extensions/ext-wernis.php
inc/extensions/ext-yoomedia.php
inc/functions.php
inc/gen_refback.php
inc/header.php
inc/language/active_de.php
inc/language/admins_de.php
inc/language/autopurge_de.php
inc/language/bank_de.php
inc/language/beg_de.php
inc/language/birthday_de.php
inc/language/bonus_de.php
inc/language/cache_de.php
inc/language/country_de.php
inc/language/de.php
inc/language/doubler_de.php
inc/language/holiday_de.php
inc/language/html_mail_de.php
inc/language/install_de.php
inc/language/mailid_de.php
inc/language/maintenance_de.php
inc/language/mediadata_de.php
inc/language/mods_de.php
inc/language/newsletter_de.php
inc/language/nickname_de.php
inc/language/online_de.php
inc/language/optimize_de.php
inc/language/order_de.php
inc/language/other_de.php
inc/language/payout_de.php
inc/language/primera_de.php
inc/language/rallye_de.php
inc/language/refback_de.php [new file with mode: 0644]
inc/language/register_de.php
inc/language/repair_de.php
inc/language/rewrite_de.php
inc/language/sponsor_de.php
inc/language/support_de.php
inc/language/surfbar_de.php
inc/language/task_de.php
inc/language/theme_de.php
inc/language/top10_de.php
inc/language/transfer_de.php
inc/language/user_de.php
inc/language/wernis_de.php
inc/libs/cache_functions.php
inc/libs/refback_functions.php [new file with mode: 0644]
inc/libs/surfbar_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_points.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-memedit.php
inc/modules/guest/what-register.php
inc/modules/member/what-points.php
inc/modules/member/what-refback.php [new file with mode: 0644]
inc/mysql-connect.php
inc/mysql-manager.php
inc/security.php
install/tables.sql
templates/de/html/admin/admin_list_refs.tpl
templates/de/html/admin/admin_list_refs_level.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_refs_row.tpl
templates/de/html/ext/ext_refback.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_edit.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_list.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_list_level.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_list_row.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_list_row_deleted.tpl [new file with mode: 0644]

index efd717ce997c2d599558b62e3a6ce00e12921974..51a12c4cc3183822228b212a9044ec0097a9566e 100644 (file)
@@ -126,6 +126,7 @@ inc/extensions/ext-payout.php -text
 inc/extensions/ext-primera.php -text
 inc/extensions/ext-profile.php -text
 inc/extensions/ext-rallye.php -text
+inc/extensions/ext-refback.php -text
 inc/extensions/ext-register.php -text
 inc/extensions/ext-repair.php -text
 inc/extensions/ext-rewrite.php -text
@@ -180,6 +181,7 @@ inc/language/other_de.php -text
 inc/language/payout_de.php -text
 inc/language/primera_de.php -text
 inc/language/rallye_de.php -text
+inc/language/refback_de.php -text
 inc/language/register_de.php -text
 inc/language/repair_de.php -text
 inc/language/rewrite_de.php -text
@@ -209,6 +211,7 @@ inc/libs/order_functions.php -text
 inc/libs/payout_functions.php -text
 inc/libs/primera_functions.php -text
 inc/libs/rallye_functions.php -text
+inc/libs/refback_functions.php -text
 inc/libs/register_functions.php -text
 inc/libs/rewrite_functions.php -text
 inc/libs/security_functions.php -text
@@ -459,6 +462,7 @@ inc/modules/member/what-payout.php -text
 inc/modules/member/what-points.php -text
 inc/modules/member/what-primera.php -text
 inc/modules/member/what-rallyes.php -text
+inc/modules/member/what-refback.php -text
 inc/modules/member/what-reflinks.php -text
 inc/modules/member/what-sponsor.php -text
 inc/modules/member/what-stats.php -text
@@ -952,6 +956,7 @@ templates/de/html/admin/admin_list_rallyes.tpl -text
 templates/de/html/admin/admin_list_rallyes_row.tpl -text
 templates/de/html/admin/admin_list_rallyes_row2.tpl -text
 templates/de/html/admin/admin_list_refs.tpl -text
+templates/de/html/admin/admin_list_refs_level.tpl -text
 templates/de/html/admin/admin_list_refs_row.tpl -text
 templates/de/html/admin/admin_list_sponsor.tpl -text
 templates/de/html/admin/admin_list_sponsor_details.tpl -text
@@ -1137,6 +1142,7 @@ templates/de/html/ext/ext_payout.tpl -text
 templates/de/html/ext/ext_primera.tpl -text
 templates/de/html/ext/ext_profile.tpl -text
 templates/de/html/ext/ext_rallye.tpl -text
+templates/de/html/ext/ext_refback.tpl -text
 templates/de/html/ext/ext_register.tpl -text
 templates/de/html/ext/ext_repair.tpl -text
 templates/de/html/ext/ext_rewrite.tpl -text
@@ -1304,6 +1310,11 @@ templates/de/html/member/member_primera_mode_list.tpl -text
 templates/de/html/member/member_primera_mode_list_row.tpl -text
 templates/de/html/member/member_primera_mode_pay.tpl -text
 templates/de/html/member/member_receive_table.tpl -text
+templates/de/html/member/member_refback_edit.tpl -text
+templates/de/html/member/member_refback_list.tpl -text
+templates/de/html/member/member_refback_list_level.tpl -text
+templates/de/html/member/member_refback_list_row.tpl -text
+templates/de/html/member/member_refback_list_row_deleted.tpl -text
 templates/de/html/member/member_reflinks_row.tpl -text
 templates/de/html/member/member_reflinks_table.tpl -text
 templates/de/html/member/member_stats_pool.tpl -text
index fd4c517ccae2d00f1a1b55dd90a43c3e950c577d..f588661844da1cb90f046d6670b2d315a60dfd94 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "412");
+define('CURR_SVN_REVISION', "413");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 1a24f3928997617cc2a11b484fa5edf773e9527e..fe033aeb965e2ea8fe7f902a93c31ff68a3ed5d9 100644 (file)
@@ -285,7 +285,7 @@ function SQL_ESCAPE($str, $secureString=true,$strip=true) {
 
        if (function_exists('mysql_real_escape_string')) {
                // The new and improved version
-               //* DEBUG: */ echo __FUNCTION__.":str={$str}<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):str={$str}<br />\n";
                return mysql_real_escape_string($str, $link);
        } elseif (function_exists('mysql_escape_string')) {
                // The obsulete function
index 1851e5d4a851379affe3c2b345b75e45dc8f53c6..64e4c486993fe001850a65d2f25707c8557f0437 100644 (file)
@@ -57,6 +57,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false)
        // Does this extension exists?
        if (FILE_READABLE($file)) {
                // Extension was found so we can load it in registration mode
+               $EXT_ALWAYS_ACTIVE = "N";
                require($file);
 
                // And run possible updates
@@ -99,6 +100,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false)
                        if (FILE_READABLE($file)) {
                                // File exists so let's load it
                                $VER_BACKUP = $EXT_VERSION;
+                               $EXT_ALWAYS_ACTIVE = "N";
                                require($file);
                                $EXT_VERSION = $VER_BACKUP;
 
@@ -245,6 +247,9 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
        global $cacheInstance, $_CONFIG;
        $SQLs = array();
 
+       // Extensions are never active by default
+       $EXT_ALWAYS_ACTIVE = "N";
+
        // By default no SQL has been executed
        $sqlRan = false;
 
@@ -256,14 +261,14 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
        if (empty($ext_name)) return false;
 
        // Load extension in detected mode
-       //* DEBUG: */ echo __FUNCTION__.":ext_name[{$id}]={$ext_name}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ext_name[{$id}]={$ext_name}<br />\n";
        $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
        if (FILE_READABLE($file)) {
                // Load the include
                require($file);
        } // END - if
 
-       //* DEBUG: */ echo __FUNCTION__.":SQLs::count=".count($SQLs)."<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):SQLs::count=".count($SQLs)."<br />\n";
        if ((is_array($SQLs) && (sizeof($SQLs) > 0))) {
                // Run SQL commands...
                foreach ($SQLs as $sql) {
@@ -273,7 +278,7 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
                        // Is there still an SQL query?
                        if (!empty($sql)) {
                                // Do we have an "ALTER TABLE" command?
-                               //* DEBUG: */ echo __FUNCTION__.":SQL={$SQL}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):SQL={$SQL}<br />\n";
                                if (substr(strtolower($sql), 0, 11) == "alter table") {
                                        // Analyse the alteration command
                                        SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
@@ -294,7 +299,7 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
                         array($id), __FILE__, __LINE__);
                } // END - if
 
-               //* DEBUG: */ echo __FUNCTION__.":mode={$EXT_LOAD_MODE}<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mode={$EXT_LOAD_MODE}<br />\n";
 
                // Remove cache file(s) if extension is active
                if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1) && ($EXT_LOAD_MODE == "remove")) || ($sqlRan === true))) {
@@ -356,9 +361,6 @@ function EXT_IS_ACTIVE ($ext_name) {
                $cacheArray['extensions']['ext_active'][$ext_name] = "N";
        }
 
-       // Create FQFN for extension file
-       $inc = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
-
        // Debug message
        //DEBUG_LOG(__FUNCTION__.": ext_name={$ext_name},active={$active}");
 
@@ -372,12 +374,12 @@ function GET_EXT_VERSION ($ext_name) {
 
        // Extensions are all inactive during installation
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return "";
-       //* DEBUG: */ echo __FUNCTION__.": ext_name={$ext_name}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ext_name={$ext_name}<br />\n";
 
        // Is the cache written?
        if (!empty($cacheArray['extensions']['ext_version'][$ext_name])) {
                // Load data from cache
-               //* DEBUG: */ echo __FUNCTION__.": CACHE!<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): CACHE!<br />\n";
                $ret = $cacheArray['extensions']['ext_version'][$ext_name];
 
                // Count cache hits
@@ -394,7 +396,7 @@ function GET_EXT_VERSION ($ext_name) {
        }
 
        // Return result
-       //* DEBUG: */ echo __FUNCTION__.": ret={$ret}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret={$ret}<br />\n";
        return $ret;
 }
 //
index 82f8c63625bbe0169876a290d1f97e8d3d29e421..d3d013a19feb9359586d0ebab3830ecdbf0ec7b4 100644 (file)
@@ -127,8 +127,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "active";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 2fd08526e0c5da278bdcdfb850285c359bdfb3bd..8b389d011a00b41f418308a0aaf2dca5e855553f 100644 (file)
@@ -292,8 +292,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "admins";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 1118d051923efd0186f9994188278b0353fea2b5..4780f0102982ac03d2e4029217a6a0b6b31f9b52 100644 (file)
@@ -87,8 +87,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "admintheme";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 9d997f88745f514b0558e2bcd63aaef130d4bd87..6e3c8befc09e877e1888ec46031c22dc7b2cedc0 100644 (file)
@@ -84,11 +84,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "admintheme";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 24e410c436c497fc02aa51c25f81237450f799c9..12f02fabf141663f37c3f9029959d787d9537c60 100644 (file)
@@ -191,8 +191,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "bank";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 9adc3583d9b470cf3be3df978b89cbec157508ef..3b1daa75c8e035f9455fbc5ad8e2d4c0b04fb0ac 100644 (file)
@@ -271,8 +271,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "beg";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 94f1ae0667f8c26b2faa3d82e127fa5644c9b009..17d538640a5ba8fe86bcd574fe22b94eda6bdd9b 100644 (file)
@@ -201,8 +201,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "birthday";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 913982ff5bc0add4d90e3b527aedc51eca581142..9e22079fe438a4d367168aa9e0ade608f6ca201d 100644 (file)
@@ -558,8 +558,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "bonus";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index b57a15f2b377dbf66f98eb31c1f8d5ed3508aa75..f1db9c8cca3aefca91f180975ccc70758e89938e 100644 (file)
@@ -200,7 +200,7 @@ default: // Do stuff when extension is loaded
                $cacheInstance = new mxchange_cache($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']);
                if ($cacheInstance->getStatus() != "done") {
                        // Failed to initialize cache sustem
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_INITIALIZE);
                }
        }
        break;
index 916b0ad196a3b145a107ba11d0d0cf250fddf523..220a5e296e179a909e5223e0d62fb09dd37c5b1c 100644 (file)
@@ -81,11 +81,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "demo";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index c2bf7992cd847904f0d4fca92b43519e40a92844..edd3ee345e501060b8a98afd2427849351591a4e 100644 (file)
@@ -245,8 +245,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "doubler";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 5a8c2a98236b032b6c1555a3dcf2fa52e1419f59..1d6a3187abd2fa43338a36a191ddaaf200de3330 100644 (file)
@@ -229,8 +229,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "holiday";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index aa270798f125baf18c914472cc2e0b21ee493192..9c223e3f499fed51a0fc7d409f9c288fcdff591c 100644 (file)
@@ -163,11 +163,9 @@ default: // Do stuff when extension is loaded
        );
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "html_mail";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 4848fd75d17c052297437ab48e083d0f4ff2809c..be23ece91c7040d9759ddbe1655621afe6573196 100644 (file)
@@ -242,8 +242,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "mailid";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 506759b45e304f8377cacc602459253e5b873482..01f5954c3a256fd9836a59f578a9b81e42d0137e 100644 (file)
@@ -115,11 +115,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "mods";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 0eaf6a219123af6634a56993ad3997faa20826a2..32b1f1efa668d6df50173336c5d9ecca10559c4d 100644 (file)
@@ -169,8 +169,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "mydata";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 89757dba25ebfbfaaa8313fe1ec139b42cf4ec50..648cdb1cdd8e1cd34a16fb370455b2a6c7dd5c15 100644 (file)
@@ -175,8 +175,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "newsletter";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index f226afa7cf92e82dd0128262de974374733ad2a1..3ef849f832f8449410f76349f281a557784bbb82 100644 (file)
@@ -210,8 +210,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "nickname";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 196d3cfe6bef3b8210f88f1f688924f575ae9736..6b1fa94f443b65fdcd7003834a538ebd0337264c 100644 (file)
@@ -114,11 +114,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "online";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 56d730d0bdaacd08dc9d2ab47d2cdef3570a7db3..5a7d2a924f28bc6bbe5a1350d4967bf20a061cba 100644 (file)
@@ -314,8 +314,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "order";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index c11afdca2615d09c8fff91fefa87e720dfc4fff2..be3ef40a8e2d95a7a009632938ca3433dce67a63 100644 (file)
@@ -241,11 +241,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "payout";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 8e2253d0e536dbb8216a96c1a310350e9f220485..11ea3b372c2380d07d225710cf1ebfdac609cd21 100644 (file)
@@ -116,9 +116,6 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "primera";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 // Init array
 global $primera;
 $primera = array();
index 42c499227e43b356c8f448c255452d01a9944c8d..c8da12066b511161234fdd72a55a64cb1fbf3265 100644 (file)
@@ -130,8 +130,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "profile";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 4424c369a3125b1bf14070b6de1378996b8a64c6..5d34c754f48dc4b89bbe222de5babbac241d957d 100644 (file)
@@ -348,8 +348,5 @@ LIMIT 1", __FILE__, __LINE__);
 // Language file prefix
 $EXT_LANG_PREFIX = "rallye";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php
new file mode 100644 (file)
index 0000000..446d0d6
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/29/2008 *
+ * ================                             Last change: 09/29/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : ext-refback.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Refback and ref overview                         *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Ref-Back und Ref-Uebersicht                      *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Version number
+$EXT_VERSION = "0.0";
+
+// Auto-set extension version
+if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
+
+// Version history array (add more with , "0.1" and so on)
+$EXT_VER_HISTORY = array("0.0");
+
+switch ($EXT_LOAD_MODE)
+{
+case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+       // SQL commands to run
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_refs`";
+       $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_user_refs` (
+`id` bigint(20) NOT NULL auto_increment,
+`userid` bigint(20) NOT NULL DEFAULT 0,
+`level` smallint(6) NOT NULL DEFAULT 0,
+`refid` bigint(20) NOT NULL DEFAULT 0,
+`refback` float(4,1) NOT NULL DEFAULT 0.0,
+`points` FLOAT( 20,5) DEFAULT '0.00000' NOT NULL,
+PRIMARY KEY (`id`),
+UNIQUE `user_refid` (`userid`,`level`,`refid`),
+KEY (`level`),
+KEY (`refid`)
+) ENGINE=MyISAM COMMENT='User Referals With Refback'";
+       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','refback','Ref-Back/Ref-&Uuml;bersicht',4,'N','N')";
+       break;
+
+case "remove": // Do stuff when removing extension
+       // SQL commands to run
+       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_refs";
+       $SQLS[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='refback' LIMIT 1";
+       break;
+
+case "activate": // Do stuff when admin activates this extension
+       // SQL commands to run
+       $SQLs[] = "";
+       break;
+
+case "deactivate": // Do stuff when admin deactivates this extension
+       // SQL commands to run
+       $SQLs[] = "";
+       break;
+
+case "update": // Update an extension
+       switch ($EXT_VER)
+       {
+       case "0.0.1": // SQL queries for v0.0.1
+               $SQLs[] = "";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "";
+               break;
+       }
+       break;
+
+default: // Do stuff when extension is loaded
+       // When the refback is not installed we cannot load it's configuration... *sigh*
+       break;
+}
+
+// Shall we include special files?
+if ($EXT_LOAD_MODE == "register") {
+       // Execute this special file on this update
+       $INC_POOL[] = PATH."inc/gen_refback.php";
+} // END - if
+
+// Language file prefix (hmmm, what shall I write with SQL fixes? ;-) )
+$EXT_LANG_PREFIX = "refback";
+
+// Extension is always active?
+$EXT_ALWAYS_ACTIVE = "Y";
+
+//
+?>
index a179131f51debf53c00037ef2a6352dbdd87a52c..209069755628063244bab317669364be0cd751d8 100644 (file)
@@ -328,8 +328,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "register";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 21935c7a17a70981d8abba7c47be3618167ced64..20e442d81caddf37642488b327290ad52924e91b 100644 (file)
@@ -111,11 +111,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "repair";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index fc04a655f121b1d32378b5546b37bc25820289b0..d0741fd8aead1b8c93c7193c16f79343677add2b 100644 (file)
@@ -141,8 +141,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "rewrite";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 759bce29eef042a1ead6f3487e103e18962100ce..690d6835ea2678306788565b874c7de58db30c68 100644 (file)
@@ -84,8 +84,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "safe";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 21401127ddbb508433807eac3a6caf184f5f0c44..262e75c16a3695e7c92b16f6a67285118577c542 100644 (file)
@@ -432,8 +432,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "sponsor";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 1cfd76056c9d036024c3ac569e9918ae19c9bd97..11c808fc3bac44cedae5759ad16f660631b47527 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.5.0";
+$EXT_VERSION = "0.5.2";
 
 // Auto-set extension version
 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "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");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "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");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -76,7 +76,8 @@ what='stats2' OR
 (action='stats' AND (what='' OR what IS NULL)) OR
 (action='extras' AND (what='' OR what IS NULL)) OR
 (action='rals' AND (what='' OR what IS NULL)) OR
-(action='account' AND (what='' OR what IS NULL)) LIMIT 8";
+(action='account' AND (what='' OR what IS NULL))
+LIMIT 8";
        $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='main' WHERE
 action='stats' OR
 action='extras' OR
@@ -85,12 +86,9 @@ action='account'";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_refs";
 
        // Drop indexes
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY (ext_name)";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes DROP UNIQUE KEY (theme_path)";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes DROP INDEX (theme_active)";
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY (login)";
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data DROP INDEX (status)";
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX (visible)";
@@ -238,8 +236,8 @@ case "update": // Update an extension
                $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
                $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis &quot;theme&quot; nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)";
                $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standart-Theme &quot;default&quot; auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server l&ouml;schen, damit es niht erneut importiert werden kann.', 2)";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (action,what,title,sort,visible,locked) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action,what,title,sort,visible,locked) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')";
+               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')";
+               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')";
                $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
                $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -351,7 +349,7 @@ PRIMARY KEY(id)
                break;
 
        case "0.2.7": // SQL queries for v0.2.7
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort) VALUES ('main','themes','Designs', 6)";
+               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action,what,title,sort) VALUES ('main','themes','Designs', 6)";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD stats_limit BIGINT(20) UNSIGNED NOT NULL DEFAULT '10'";
                $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='config_stats' WHERE what='stats' LIMIT 1";
@@ -637,25 +635,23 @@ PRIMARY KEY (id)
        case "0.5.0": // SQL queries for v0.5.0
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refsystem` DROP INDEX `level`";
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refsystem` DROP INDEX `userid`, ADD UNIQUE `userid_level` (`userid`,`level`)";
-               $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_refs`";
-               $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_user_refs` (
-`id` bigint(20) NOT NULL auto_increment,
-`userid` bigint(20) NOT NULL DEFAULT 0,
-`level` smallint(6) NOT NULL DEFAULT 0,
-`refid` bigint(20) NOT NULL DEFAULT 0,
-`refback` float(4,1) NOT NULL DEFAULT 0.0,
-`points` FLOAT( 20,5) DEFAULT '0.00000' NOT NULL,
-PRIMARY KEY (`id`),
-UNIQUE `user_refid` (`userid`,`level`,`refid`),
-KEY (`level`),
-KEY (`refid`),
-) ENGINE=MyISAM COMMENT='User Referals With Refback'";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Referal-System unterst&uuml;tzt nun detailierte Referal-&Uuml;bersicht und vieles mehr.";
+               break;
+
+       case "0.5.1": // SQL queries for v0.5.1
+               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu DROP `descr`";
 
-               // Execute this special file on this update
-               $INC_POOL[] = PATH."inc/gen_refback.php";
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Beschreibungsspalte von Mitgliedsmen&uuml; entfernt, welche ohnehin nicht genutzt wird.";
+               break;
+
+       case "0.5.2": // SQL queries for v0.5.2
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refdepths` CHANGE `percents` `percents` FLOAT(8,5) NOT NULL DEFAULT '0.00000'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Prozents&aum;tze k&ouml;nnen nun f&uuml;nf Stelle hinter dem Komma sein.";
                break;
        }
        break;
index ccfe1974678432912e4a2d89421e2e8a26e8cb84..b8d6d897798c8180355d486193a12b8bb26bf028 100644 (file)
@@ -128,11 +128,9 @@ case "update": // Update an extension
 default: // Do stuff when extension is loaded
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "support";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 14f942796d0d769f0bb12dbf9907533b0b5f137d..e67e15bb1d35283e59031bb0e00ba15a8d2f5e68 100644 (file)
@@ -232,8 +232,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "surfbar";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 1611eea8006796127ca8793d65311d36b4f90756..2fd0a1f676aedb10e3c1f921dda57f589a1494e6 100644 (file)
@@ -247,8 +247,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "task";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 20520b2b738479757d8636ff36f80a9274662384..84a47283507bd926d5935e2b3dadbb42b1e0815a 100644 (file)
@@ -117,8 +117,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "theme";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 1b48c0953bd1810d2f9bc45fc05f987efb75abb6..358367b59729921d558a53fc1086e9a5e3155e26 100644 (file)
@@ -146,8 +146,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "top10";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 7814a955289d3b2ffac0bb363ff7b0b91ec0ec61..55402ebd20099e5f416480460a98069ed866dd0c 100644 (file)
@@ -287,8 +287,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "transfer";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 5518a3feca20499ad1e4126de0f0d4b3c6e07982..672ec5089d6f4a5ca010df8ded1fcbc3578c7d57 100644 (file)
@@ -131,9 +131,6 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "wernis";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 // Init array
 global $WERNIS;
 $WERNIS = array();
index a38bd27bc3a22605e7bc22b60d6973a7c837852f..99724405e3e64d7ac5b523ed16c78a39e1899ec2 100644 (file)
@@ -85,8 +85,5 @@ default: // Do stuff when extension is loaded
 // Language file prefix
 $EXT_LANG_PREFIX = "yoomedia";
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
 //
 ?>
index 3dcee7a5cce4ea43680c3ae67ac6ee7f27ff18a3..1c22981c1c5c3fc3b1ce41c0b1e57ba86ea88597 100644 (file)
@@ -236,7 +236,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
 
                // Free result
                SQL_FREERESULT($result);
-       }
+       } // END - if
 
        // Generate date/time string
        $date_time = MAKE_DATETIME(time(), "1");
@@ -351,7 +351,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
 
 // Send mail out to an email address
 function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML = "N", $FROM = "") {
-       //* DEBUG: */ echo __FUNCTION__.":TO={$TO},SUBJECT={$SUBJECT}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$TO},SUBJECT={$SUBJECT}<br />\n";
 
        // Compile subject line (for POINTS constant etc.)
        $eval = "\$SUBJECT = html_entity_decode(\"".COMPILE_CODE(addslashes($SUBJECT))."\");";
@@ -366,7 +366,7 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML = "N", $FROM = "") {
                } else {
                        // Load email address
                        $result_email = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($TO)), __FILE__, __LINE__);
-                       //* DEBUG: */ echo __FUNCTION__.":numRows=".SQL_NUMROWS($result_email)."<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result_email)."<br />\n";
 
                        // Does the user exist?
                        if (SQL_NUMROWS($result_email)) {
@@ -384,7 +384,7 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML = "N", $FROM = "") {
                // Is the webmaster!
                $TO = WEBMASTER;
        }
-       //* DEBUG: */ echo __FUNCTION__.":TO={$TO}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$TO}<br />\n";
 
        // Check for PHPMailer or debug-mode
        if (!CHECK_PHPMAILER_USAGE()) {
@@ -562,8 +562,8 @@ function TRANSLATE_COMMA ($dotted, $cut=true) {
                if (count($com) > 1) {
                        // Commata found, so only zeros?
                        if ($com[1] == str_repeat("0", strlen($com[1]))) {
-                               // Only zeros, so don't display them
-                               $maxComma = 0;
+                               // Only zeros, so display only one
+                               $maxComma = 1;
                        } // END - if
                } else {
                        // Don't display commatas even if there are none... ;-)
@@ -645,6 +645,11 @@ function TRANSLATE_STATUS($status) {
                $ret = ACCOUNT_LOCKED;
                break;
 
+       case "":
+       case null:
+               $ret = ACCOUNT_DELETED;
+               break;
+
        default:
                $ret = UNKNOWN_STATUS_1.$status.UNKNOWN_STATUS_2;
                break;
@@ -738,27 +743,27 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
        } // END - if
 
        // Load user's data
-       //* DEBUG: */ echo __FUNCTION__.":UID={$UID},template={$template}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template}<br />\n";
        if ($UID > 0) {
                if (EXT_IS_ACTIVE("nickname")) {
-                       //* DEBUG: */ echo __FUNCTION__.":NICKNAME!<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />\n";
                        // Load nickname
                        $result = SQL_QUERY_ESC("SELECT surname, family, gender, email, nickname FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
                                array(bigintval($UID)), __FILE__, __LINE__);
                } else {
-                       //* DEBUG: */ echo __FUNCTION__.":NO-NICK!<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NO-NICK!<br />\n";
                        /// Load normal data
                        $result = SQL_QUERY_ESC("SELECT surname, family, gender, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
                                array(bigintval($UID)), __FILE__, __LINE__);
                }
 
                // Is content an array?
-               //* DEBUG: */ echo __FUNCTION__.":content[]=".gettype($content)."<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content[]=".gettype($content)."<br />\n";
                if (is_array($content)) {
                        // Fetch and migrate data
-                       //* DEBUG: */ echo __FUNCTION__.":content()=".count($content)." - PRE<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
                        $content = array_merge($content, SQL_FETCHARRAY($result));
-                       //* DEBUG: */ echo __FUNCTION__.":content()=".count($content)." - AFTER<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\n";
                } // END - if
 
                // Free result
@@ -952,10 +957,10 @@ function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) {
                                $test = substr($found, 0, strlen($match));
 
                                // Does this entry exist?
-                               //* DEBUG: */ echo __FUNCTION__.":found={$found},match={$match},set={$set}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found={$found},match={$match},set={$set}<br />\n";
                                if ($test == $match) {
                                        // Match found!
-                                       //* DEBUG: */ echo __FUNCTION__.":fuzzyFound!<br />\n";
+                                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):fuzzyFound!<br />\n";
                                        $fuzzyFound = true;
                                        break;
                                } // END - if
@@ -967,14 +972,14 @@ function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) {
                        // Take all string elements
                        if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) {
                                // Replace it in the code
-                               //* DEBUG: */ echo __FUNCTION__.":key={$key},match={$match}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):key={$key},match={$match}<br />\n";
                                $newMatch = str_replace("[".$matches[4][$key]."]", "['".$matches[4][$key]."']", $match);
                                $code = str_replace($match, "\".".$newMatch.".\"", $code);
                                $matchesFound[$key."_".$matches[4][$key]] = 1;
                                $matchesFound[$match] = 1;
                        } elseif (!isset($matchesFound[$match])) {
                                // Not yet replaced!
-                               //* DEBUG: */ echo __FUNCTION__.":match={$match}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):match={$match}<br />\n";
                                $code = str_replace($match, "\".".$match.".\"", $code);
                                $matchesFound[$match] = 1;
                        }
@@ -1648,7 +1653,7 @@ function EXTRACT_HOST (&$script) {
        if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
 
        // Generate relative URL
-       //* DEBUG */ print("SCRIPT=".$script."<br />\n");
+       //* DEBUG: */ print("SCRIPT=".$script."<br />\n");
        if (substr(strtolower($script), 0, 7) == "http://") {
                // But only if http:// is in front!
                $script = substr($script, (strlen($url) + 7));
@@ -1657,7 +1662,7 @@ function EXTRACT_HOST (&$script) {
                $script = substr($script, (strlen($url) + 8));
        }
 
-       //* DEBUG */ print("SCRIPT=".$script."<br />\n");
+       //* DEBUG: */ print("SCRIPT=".$script."<br />\n");
        if (substr($script, 0, 1) == "/") $script = substr($script, 1);
 
        // Return host name
@@ -1740,7 +1745,7 @@ function SEND_RAW_REQUEST ($host, $request) {
        } // END - if
 
        // Open connection
-       //* DEBUG */ die("SCRIPT=".$script."<br />\n");
+       //* DEBUG: */ die("SCRIPT=".$script."<br />\n");
        if ($useProxy) {
                $fp = @fsockopen(COMPILE_CODE($_CONFIG['proxy_host']), $_CONFIG['proxy_port'], $errno, $errdesc, 30);
        } else {
@@ -2245,11 +2250,11 @@ function isBooleanConstantAndTrue($constName) { // : Boolean
        // In cache?
        if (isset($constCache[$constName])) {
                // Use cache
-               //* DEBUG: */ echo __FUNCTION__.": ".$constName."-CACHE!<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-CACHE!<br />\n";
                $res = $constCache[$constName];
        } else {
                // Check constant
-               //* DEBUG: */ echo __FUNCTION__.": ".$constName."-RESOLVE!<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-RESOLVE!<br />\n";
                if (defined($constName)) $res = (constant($constName) === true);
 
                // Set cache
@@ -2263,7 +2268,7 @@ function isBooleanConstantAndTrue($constName) { // : Boolean
 
 // Check wether a session variable is set
 function isSessionVariableSet($var) {
-       //* DEBUG: */ echo __FUNCTION__.":var={$var}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):var={$var}<br />\n";
        return (isset($_SESSION[$var]));
 }
 // Returns wether the value of the session variable or NULL if not set
@@ -2326,7 +2331,7 @@ function DEBUG_LOG ($message, $force=false) {
        if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) {
                // Log this message away
                $fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
-               fwrite($fp, date("d.m.Y|H:i:s", time())."|{$message}\n");
+               fwrite($fp, date("d.m.Y|H:i:s", time())."|".strip_tags($message)."\n");
                fclose($fp);
        } // END - if
 }
@@ -2344,7 +2349,7 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
                $file = $baseDir.$baseFile;
 
                // Is this a valid reset file?
-               //* DEBUG: */ echo __FUNCTION__.":baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}<br />\n";
                if ((FILE_READABLE($file)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) {
                        // Remove both for extension name
                        $extName = substr($baseFile, strlen($prefix), -4);
@@ -2510,7 +2515,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) {
                // Ignore zero values
                if (get_session('mxchange_'.$accessLevel.'_failtures') > 0) {
                        // Non-guest has login failtures found, get both data and prepare it for template
-                       //* DEBUG: */ echo __FUNCTION__.":accessLevel={$accessLevel}<br />\n";
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):accessLevel={$accessLevel}<br />\n";
                        $content = array(
                                'login_failtures' => get_session('mxchange_'.$accessLevel.'_failtures'),
                                'last_failture'   => MAKE_DATETIME(get_session('mxchange_'.$accessLevel.'_last_fail'), "2")
index 3e79ad1d7d835d099121df8e63b70d948b9687c6..be1a3a768967ce01de2acce01c79c00b7a711b27 100644 (file)
@@ -37,6 +37,9 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
+// Make sure our functions are there
+require_once(PATH."inc/libs/refback_functions.php");
+
 // Sanity-check: Do we have ref level 0?
 $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_refsystem WHERE level=0", __FILE__, __LINE__);
 if (SQL_NUMROWS($result) > 0) {
@@ -66,7 +69,7 @@ if (SQL_NUMROWS($result_direct) > 0) {
                $cacheArray['back_level'] = 1;
 
                // Update refback table
-               /* DEBUG: */ echo "uid={$uid}<br />\n";
+               //* DEBUG: */ echo "uid={$uid}<br />\n";
                UPDATE_REFBACK_TABLE($uid);
        } // END - while
 } // END - if
index 8f2d54deae8f6518ec0d94e4a5a4b05c0ce70e83..fe18f73c4e5add995bac2de8534de4b4f3f6009f 100644 (file)
@@ -104,13 +104,15 @@ if (($header != "1") && ($header != "2")) {
                // Output page header code
                LOAD_TEMPLATE("page_header");
 
-               // Include meta data here
-               LOAD_TEMPLATE("metadata");
-
-               // Add meta description to header
-               if ((isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && ($GLOBALS['module'] != "admin") && ($GLOBALS['module'] != "login") && (isset($db)) && (isset($link))) {
-                       // Add meta description not in admin and login module and when the script is installed
-                       META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);
+               // Include meta data in "guest" module
+               if ($GLOBALS['module'] == "index") {
+                       LOAD_TEMPLATE("metadata");
+
+                       // Add meta description to header
+                       if ((isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (isset($db)) && (is_resource($link))) {
+                               // Add meta description not in admin and login module and when the script is installed
+                               META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);
+                       } // END - if
                } // END - if
 
                // Include more header data here
index 11347e2c94d7eec180a933235607ec368308e622..2f692a450b852efd7793c5272cda52cf2e015a2c 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 76a56e20fe6c09213502d3bd966ad66a4c3464d8..c71507218354765b3335a68e1a32567ca7847d87 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index b4f8c0b5ab78fd0b2808cb31e030106b8762af1b..f5b9566e1fa5f7c03eaf3dd1107186c7fad45f1f 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 281ae6d933f2695674747189ac8aec1e0f111a1d..f08218a52c946fcc1291eaea553f65569af9475e 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index ac4cbe9b34b76d6a45a0e64354c3a1e10a6d2a1f..2b25ea26437e374c5c76aeae04c0dc3ce65add41 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index c3873135bccfeddc7605d30d8d8e145c2c68a2ab..17733a4f089be1836228299aa14929724e5a5dc2 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 150aa911e70744500fc7ec25b9b658c11833321b..aa873c6b111829c08665f7aea3d0ae2111aed850 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index c66f0fc98940c68859dd37c377ae3a66bf98bdad..66f0b04c2ef78eb3a7482f939387de9ce35c2efc 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index ba04f5a6c1ab0cc35cd3175b3574df86713b31ce..ebb1d03a9a14e28354aa1a32c7565a02fe9c81ee 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 03305c6d9560c3c0fdcedd00e150c498439ac435..46b9208d042d148177fea525d51f7f4626ead9e7 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
@@ -513,6 +512,7 @@ define('ACCOUNT_STATUS', "Account-Status");
 define('ACCOUNT_UNCONFIRMED', "<SPAN class=\"admin_failed\">Unbest&auml;tigt</SPAN>");
 define('ACCOUNT_CONFIRMED', "<SPAN class=\"admin_green\">Best&auml;tigt</SPAN>");
 define('ACCOUNT_LOCKED', "Gesperrt");
+define('ACCOUNT_DELETED', "Gel&ouml;scht");
 define('ADMIN_ALL_ACCOUNTS', "Alle Mitglieder-Accounts auflisten");
 define('ADMIN_LIST_LOCKED_ACCOUNTS', "Alle gesperrten Mitglieder-Accounts auflisten");
 define('ADMIN_LIST_CONFIRMED_ACCOUNTS', "Alle best&auml;tigten Mitglieder-Accounts auflisten");
index 4ec574fefc22cbead46ebd50c435e34af295ea7c..d54e12f51a7b8d0c1a0c1522c65a932bf89b5ddb 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 248cb3ab348cf53f18a4b887b68ee60723b20b2d..2233d5d445a6f22c18e5c7c9b56bd063b330ca61 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index ddec173c27702e92e94b974ff851cfc978f99108..239d7d0a7e36d6f195c49754f555334c9a3d2f13 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index c9dd1e2820e1b6d35bb65f136c09c17280ae16b6..540f550ce89b766cf67fd8aa19f20569340e8a9f 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index c9d4896da0075bf311fe42ab277ada9f67b50431..43df81bd4e174d8bb991aa77062a18cf93e2d785 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 6028a8cf006353c355e7635088f1e2403b81e513..939ccacc57f0365c60b22a41c1bc9b79f6dcd1da 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 6e05e5b1ca224862c2731897710e86c43ac11731..5a85c73e52d87be9f4a8e04cff2738a76a64d199 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 29694f8e45d341bb9c35588790f8a72a8a88bd6d..9e1fbf53c5818edd65de81ebfab5459bad6bf9a4 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 8c502016d6228c169a3716504afae5ab530c7054..f4d29c3183df8e932d123f27deb0e3f03aa3597b 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 11a23c627343fba939dc63a14f67cb8c4b274575..d3bd0b5be8d52019010fe07f20e26992cf8756e5 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 8c21f889a10f4602cc25d2d4aca9697cbbe1bea5..db5313dafca85c95bda480ca2b7fe85c80a31d36 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 4f2f778eb7867606d79e7cf40b9038298c5af952..fa2e35de3c4e4a3cc9e3703fa3b2074fc1667a50 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 1acea0adf703a608f119484cdc6f2be06b0ec4ae..be9999d3a65510f83c0cce32e226f0bafc441707 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index cf6d2948e881f82948d323ffe4e1209b8f1af878..eaaee7386088144ff7058fdec6a26e585c924060 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 264578a9fa024d6e871451327ebaec2e62d6bcc0..8ad9e0d560eaa7e6ff156f2a7a8452c2a586e93b 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 1e2eb96365252eb6e40eed8fcbc2593b51aa5077..9e8bc908108d24cf1f83b9285e0b9d50e3edb678 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index b877f3a32dac19a39bb3605a4eafb9e345618678..0094713e4f7e1f0b74663885638e9d9ec4d6acb6 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
diff --git a/inc/language/refback_de.php b/inc/language/refback_de.php
new file mode 100644 (file)
index 0000000..f85bb27
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/29/2008 *
+ * ===============                              Last change: 09/29/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : refback_de.php                                   *
+ * -------------------------------------------------------------------- *
+ * Short description : German langugage support                         *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Deutsche Sprachunterst&uuml;tzung                *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Member language strings
+define('MEMBER_REFBACK_LIST_TITLE_1', "Ref-Back &Uuml;bersicht f&uuml;r Referal-Ebene <u>");
+define('MEMBER_REFBACK_LIST_TITLE_2', "</u> (<u>");
+define('MEMBER_REFBACK_LIST_TITLE_3', "</u>% Ref-Verg&uuml;tung)");
+define('MEMBER_REFBACK_TITLE', "Ref-Back und Referal-&Uuml;bersicht");
+define('MEMBER_REFBACK_NOTE', "Hier k&ouml;nnen Sie in jeder Referal-Ebene jedem von Ihnen geworbenen Mitglied Ref-Back einstellen. Sollte Ihr Referal {!POINTS!} verdienen und diese ihm/ihr nicht direkt gutgeschrieben werden, so erh&auml;lt Ihr Referal die eingestellten Prozente von dem Verdienst aufgebucht, den Sie als Ref-Verdienst erhalten. Unter <strong>{--MEMBER_REFBACK_POINTS--}</strong> sind die {!POINTS!}-Gutschriften durch Ref-Back an das jeweilige Mitglied zu verstehen.");
+define('MEMBER_REFBACK_NO_ENTRIES', "Es gibt technische Probleme mit der Refback-Tabelle. Bitte Support benachrichtigen.");
+define('MEMBER_REFBACK_EDIT_SUBMIT', "Refback einstellen");
+define('MEMBER_REFBACK_COUNTER_1', "In dieser Ebene haben Sie <u>");
+define('MEMBER_REFBACK_COUNTER_2', "</u> Mitglieder geworben.");
+define('MEMBER_REFBACK_REFID', "User-ID (Nickname)");
+define('MEMBER_REFBACK_STATUS', "Referal-Status");
+define('MEMBER_REFBACK_PERCENTS', "Ref-Back Prozente");
+define('MEMBER_REFBACK_POINTS', "Ref-Back Verg&uuml;tung");
+define('MEMBER_REFBACK_EDIT', "Einstellen");
+define('MEMBER_REFBACK_EDIT_TITLE', "Ref-Back f&uuml;r ausgew&auml;hltes Mitglied einstellen:");
+define('MEMBER_REFBACK_DELETED_SUBMIT', "Nicht m&ouml;glich");
+define('MEMBER_REFBACK_DELETED_TITLE', "Einstellen von Ref-Back ist f&uuml;r gel&ouml;schte Mitglieder nicht m&ouml;glich.");
+
+// Error messages for members
+define('MEMBER_REFBACK_ERROR_MESSAGE', "Fehler beim Einstellen des Ref-Backs. Fehlermeldung:<br />\n<u>%s</u>");
+define('MEMBER_REFBACK_ERROR_GENERAL', "Allgemeiner Scriptefehler. Bitte beim Support melden.");
+define('MEMBER_REFBACK_ERROR_NO_MEMBER', "Nur Mitglieder k&ouml;nnen Ref-Backs einstellen.");
+define('MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER', "Ung&uuml;ltige ID-Nummer &uuml;bertragen.");
+define('MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE', "Prozentsatz ung&uuml;ltig. 0 bis 100 sind g&uuml;ltige Werte.");
+define('MEMBER_REFBACK_ERROR_ID_MISMATCH', "Die ausgew&auml;hlte Ref-Back ID geh&ouml;rt Ihnen nicht.");
+define('MEMBER_REFBACK_ERROR_NOT_UPDATED', "Ref-Back nicht aktualisiert.");
+define('MEMBER_REFBACK_DONE', "Ref-Back eingestellt. Dieser ist ab jetzt g&uuml;ltig.");
+
+//
+?>
index 8371c0b15c24a88265a6349ed0ce0b13f720c4b6..05a19440bf418bc3c04f0d462fe7153a15a3bad5 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index db90d963de21e36c5c4dd9c77120faa34a4296a6..da5bdd0edd7c89204b2e6cd08b1242800c6eedf2 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index f9b8ec176c954e56a772ed6ba8cfdb30deaa32a7..a8c590f2f226ddec5d13cd82a113231620d874ad 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index b9b7c195c2cdb500a4964110554424ff5e7c587d..902e0171a4b364f120953ad280d2e4e90d8f0d58 100644 (file)
@@ -31,8 +31,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
        require($INC);
 }
index 1a9eeea2aba3845548a3da82c57c1a697dc16dcc..f3be1f278e4af3690c075c88f45addc7d57b6648 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 680bbe590819e0d5fa9c272defc0682dfe5385ee..294e2c016edcad15327b1e3dcad76a88448bfc6b 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 4792d0e0201dda58747f51856483d5371b74341a..24801c6ba1326dddc8675e16a90a7eb9a07a9fe9 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index c954c4f2ce0563e0a8e8878a7fde1289dfb38183..82ce5110609fb561512bb090f15dd8c18750decf 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index fbc7acf1a88e60c4303a00a8d79d11c1c7b4da88..9bf43373bff461bd6cb9b42618a820212ab0e999 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 038f372e11c7569493bde684711828c705bd8e99..b08ae72b8c65b6e7c7f12a11faa75fb9e4e7d902 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index a0382a7b29589747fb7727ba99047ce06f5da23b..28aa38be9f0e213e49e1bc430efb4bf0461dcc3b 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index df862d63d1280648ff561b909d796179f4773d71..0efed1d7f1964ba5bd2c93b9e9d444e29f27c0af 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
index 44df62bedea920e5cb094042077a2d09bdfc163a..93af044caa08e1ef379860b8db4ffb43b25ae346 100644 (file)
@@ -132,7 +132,7 @@ class mxchange_cache
                        $this->cache_pointer = $fp;
                } else {
                        // Cannot create file
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
@@ -162,7 +162,7 @@ class mxchange_cache
                        }
                } else {
                        // Cannot create file
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
@@ -184,7 +184,7 @@ class mxchange_cache
                else
                {
                        // Cannot create file
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
@@ -219,7 +219,7 @@ class mxchange_cache
                        }
                } else {
                        // Cache file not found or not readable
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2);
                }
        }
 
@@ -237,13 +237,13 @@ class mxchange_cache
                        else
                        {
                                // Not removed!
-                               ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2);
+                               ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2);
                        }
                }
                else
                {
                        // Does not exist!
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2);
                }
        }
 
@@ -288,7 +288,7 @@ class mxchange_cache
                        }
                } else {
                        // Cannot write to cache!
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
@@ -341,7 +341,7 @@ class mxchange_cache
                        }
                } else {
                        // Cannot write to cache!
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
@@ -355,7 +355,7 @@ class mxchange_cache
                        @fwrite($this->cache_pointer, "\$cache_version['".$ext_name."'] = \"".$ext_ver."\";\n");
                } else {
                        // Cannot create file
-                       ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php
new file mode 100644 (file)
index 0000000..1009819
--- /dev/null
@@ -0,0 +1,379 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/28/2008 *
+ * ===============                              Last change: 09/28/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : refback_functions.php                            *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for refback extension                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Funktionen fuer Refback-Erweiterung              *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Payback refback for refid and reduce it for current user
+function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       global $DEPTH, $cacheArray;
+
+       // Back ref depths
+       $cacheArray['depth'][$uid][$ref] = $DEPTH; 
+
+       // Init points
+       $return = $points;
+
+       // Get all ref levels
+       $result_refs = SQL_QUERY("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE level > 0 ORDER BY level ASC", __FILE__, __LINE__);
+
+       // "Walk" through all level
+       while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
+               // Reset ref depths
+               $DEPTH = -1;
+
+               // "Walk through all refids
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
+               foreach (GET_REFBACK_USERID_ARRAY($uid, $level) as $refid) {
+                       // Skip level zero or if both are the same
+                       if ($uid == $refid) continue;
+
+                       // Get refback percents
+                       $percents = GET_REFBACK_PERCENTS($uid, $refid);
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},refid={$refid},points={$points},percents={$percents}<br />\n";
+
+                       // Some percents given?
+                       if ($percents > 0) {
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$perc},percents={$percents},level={$level}<br />\n";
+                               // Get points for refback
+                               $refback = $points * ($perc / 100) * ($percents / 100);
+
+                               // Update refback table ("refid" and "uid" must be exchanged!)
+                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_refs SET points=points+%s WHERE userid=%s AND refid=%s LIMIT 1",
+                                       array($refback, $refid, $uid), __FILE__, __LINE__);
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):refback={$refback},uid={$uid},refid={$refid} - UPDATE! (".SQL_AFFECTEDROWS().")<br />\n";
+
+                               // Add points again, but only directly
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):refback={$refback}<br />\n";
+                               ADD_POINTS_REFSYSTEM($uid, $refback, false, "0", false, "direct");
+
+                               // Reduce points if refid is found
+                               if ($refid == $ref) {
+                                       // Reduce points here!
+                                       $return = $points * ($perc / 100) - $refback;
+                                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$return} - REDUCED<br />\n";
+                               } // END - if
+                       } // END - if
+               } // END foreach
+       } // END - while
+
+       // Free result
+       SQL_FREERESULT($result_refs);
+
+       // Restore ref depth
+       $DEPTH = $cacheArray['depth'][$uid][$ref];
+
+       // Return them
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $return;
+}
+// "Getter" for refback percents
+function GET_REFBACK_PERCENTS ($uid, $ref) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref}<br />\n";
+       // Skip identical ids
+       if ($uid == $ref) return 0;
+
+       // Default is zero
+       $percents = 0;
+
+       // Get percents from database
+       $result = SQL_QUERY_ESC("SELECT refback FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND refid=%s LIMIT 1",
+               array($ref, $uid), __FILE__, __LINE__);
+
+       // Entry found? (Should be!)
+       if (SQL_NUMROWS($result) == 1) {
+               // Fetch percents
+               list($percents) = SQL_FETCHROW($result);
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):percents={$percents}<br />\n";
+       } else {
+               // Debug log
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): NO ENTRY FOUND! :-(<br />\n";
+               DEBUG_LOG(__FUNCTION__.": uid={$uid},ref={$ref} - No entry found! :-(");
+       }
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return percents
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $percents;
+}
+// "Getter" for userid array which will return only one entry
+function GET_REFBACK_USERID_ARRAY ($rid, $level) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level}<br />\n";
+       // Init userids
+       $userIds = array();
+
+       // Look for all
+       $result = SQL_QUERY_ESC("SELECT userid
+FROM "._MYSQL_PREFIX."_user_refs
+WHERE refid=%s AND level=%s
+ORDER BY userid ASC",
+               array($rid,$level), __FILE__, __LINE__);
+
+       // Entries found?
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result)."<br />\n";
+       if (SQL_NUMROWS($result) > 0) {
+               // Add all
+               while (list($userid) = SQL_FETCHROW($result)) {
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level},userid={$userid}<br />\n";
+                       $userIds[] = $userid;
+               } // END - while
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return array
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},count()=".count($userIds)."<br />\n";
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $userIds;
+}
+// Update "refback table"
+function UPDATE_REFBACK_TABLE($uid) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       global $cacheArray, $cacheInstance;
+
+       // Make it sure referral level zero (member him-/herself) is at least selected
+       if (empty($cacheArray['back_level'])) $cacheArray['back_level'] = 1;
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']}<br />\n";
+
+       // Init refid
+       $cacheArray['up_refid'][$cacheArray['back_level']] = 0;
+       $old = 0; $minus = 0;
+
+       // Check for his referral
+       $result_refid = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s ORDER BY userid ASC",
+               array(bigintval($uid)), __FILE__, __LINE__);
+
+       // When no entry was updated then we have to create it here
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found=".SQL_NUMROWS($result_refid)."<br />\n";
+       if (SQL_NUMROWS($result_refid) > 0) {
+               // Load all refids
+               while(list($cacheArray['up_refid'][$cacheArray['back_level']]) = SQL_FETCHROW($result_refid)) {
+                       // Remmber userid
+                       $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']]] = $uid;
+
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]}<br />\n";
+                       // Refid set?
+                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (!empty($cacheArray['up_refid'][$cacheArray['back_level']]))) {
+                               // New userid?
+                               if ((isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) && (isset($cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]]))) {
+                                       // New userid!
+                                       $old = $uid;
+                                       $uid = $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]];
+                                       $minus = 1;
+                                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},old={$old},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - NEW UID!<br />\n";
+                               } // END - if
+
+                               // Check existence
+                               $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
+                                       array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+
+                               // Do we have no entry?
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]},minus={$minus},numRows=".SQL_NUMROWS($result)." - FOUND!<br />\n";
+                               if (SQL_NUMROWS($result) == 0) {
+                                       // Insert this level
+                                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - ADD!<br />\n";
+                                       $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_refs (userid,level,refid) VALUES (%s,%s,%s)",
+                                               array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+
+                                       // Move to next referral level and count his counter one up!
+                                       $cacheArray['back_level']++; UPDATE_REFBACK_TABLE($cacheArray['up_refid'][($cacheArray['back_level'] - 1)]);
+                               } // END - if
+
+                               // Do we have another level here?
+                               if ((($cacheArray['back_level']-$minus) > 0) && ($old > 0)) {
+                                       // Restore old one
+                                       $uid = $old;
+
+                                       // Shall we add this as well?
+                                       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
+                                               array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+
+                                       // Do we have no entry?
+                                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]},numRows=".SQL_NUMROWS($result)." - BACK!<br />\n";
+                                       if (SQL_NUMROWS($result) == 0) {
+                                               // Insert this level
+                                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_refs (userid,level,refid) VALUES (%s,%s,%s)",
+                                                       array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+                                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - RETURNED!<br />\n";
+                                       } // END - if
+                               } // END - if
+                       } // END - if
+               } // END - while
+
+               // Free memory
+               SQL_FREERESULT($result_refid);
+       } // END - if
+
+       // When he has a referral...
+       if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) {
+               // Remove cache here
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!<br />\n";
+               if ($cacheInstance->cache_file("refback", true)) $cacheInstance->cache_destroy();
+               $cacheArray['back_cached'] = 1;
+       } // END - if
+
+       // "Walk" back here
+       $cacheArray['back_level']--;
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']} - LEVEL!<br />\n";
+
+       // Fix empty refid
+       if (!isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) $cacheArray['up_refid'][$cacheArray['back_level']-1] = 0;
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']-1]} - BACK!<br />\n";
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+}
+// "Getter" for array for user refs in given level
+function GET_USER_REFS ($uid, $level) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       // Default is no refs and no nickname
+       $ADD = "";
+       $refs = array();
+
+       // Do we have nickname installed?
+       if (EXT_IS_ACTIVE("nickname")) {
+               $ADD = ", d.nickname";
+       } // END - if
+
+       // Get refs from database
+       $result = SQL_QUERY_ESC("SELECT r.id, r.refid, r.refback, r.points, d.status".$ADD."
+FROM "._MYSQL_PREFIX."_user_refs AS r
+LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
+ON r.refid=d.userid
+WHERE r.userid=%s AND r.level=%s
+ORDER BY r.refid ASC",
+               array(bigintval($uid), bigintval($level)), __FILE__, __LINE__);
+
+       // Are there some entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Fetch all entries
+               while ($row = SQL_FETCHARRAY($result)) {
+                       // Add row
+                       $refs[$row['id']] = $row;
+               } // END - while
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return result
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $refs;
+}
+// "Getter" for refback entry
+function GET_USER_REF_ENTRY ($id) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       // Default data is nothing
+       $data = array();
+
+       // Secure id number
+       $id = bigintval($id);
+
+       // Get entry from database
+       $result = SQL_QUERY_ESC("SELECT id, refid, refback FROM "._MYSQL_PREFIX."_user_refs WHERE id=%s AND userid=%s LIMIT 1",
+               array($id, $GLOBALS['userid']), __FILE__, __LINE__);
+
+       // Is there an entry?
+       if (SQL_NUMROWS($result) == 1) {
+               // Fetch data
+               $data = SQL_FETCHARRAY($result);
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return entry
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $data;
+}
+// Update refback percents (but with some sanity-checks!
+function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       // Default status is failed
+       $status['message'] = MEMBER_REFBACK_ERROR_GENERAL;
+
+       // Do some sanity-checks
+       if (!IS_MEMBER()) {
+               // No member!
+               $status['message'] = MEMBER_REFBACK_ERROR_NO_MEMBER;
+               return $status;
+       } elseif ("".$id."" != "".bigintval($id)."") {
+               // No number!
+               $status['message'] = MEMBER_REFBACK_INVALID_ID_NUMBER;
+               return $status;
+       } elseif (($percents < 0) || ($percents > 100)) {
+               // Percentage is not valid!
+               $status['message'] = MEMBER_REFBACK_INVALID_PERCENTAGE;
+               return $status;
+       }
+
+       // Get ref entry
+       $dummy = GET_USER_REF_ENTRY($id);
+
+       // Is this valid?
+       if (count($dummy) == 0) {
+               // ID does not belong to user!
+               $status['message'] = MEMBER_REFBACK_ID_MISMATCH;
+               return $status;
+       } // END - if
+
+       // Revert german commata
+       $percents = REVERT_COMMA($percents);
+
+       // Update entry
+       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_refs SET refback='%s' WHERE id=%s AND userid=%s LIMIT 1",
+               array($percents, $id, $GLOBALS['userid']), __FILE__, __LINE__);
+
+       // Entry updated?
+       if (SQL_AFFECTEDROWS() < 1) {
+               // Entry not updated!
+               $status['message'] = MEMBER_REFBACK_NOT_UPDATED;;
+               return $status;
+       } // END - if
+
+       // All fine!
+       $status['ok'] = true;
+
+       // Return status array
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $status;
+}
+//
+?>
index 4cf38f0d2aa32962d4717fffec7264b0abf1b302..f83d4fac911e1d363d1393252870b7b25474ece2 100644 (file)
@@ -850,7 +850,7 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
                array($GLOBALS['userid'], SURFBAR_GET_ID()), __FILE__, __LINE__);
 
        // Was that update okay?
-       if (SQL_AFFECTEDROWS() == 0) {
+       if (SQL_AFFECTEDROWS() < 1) {
                // No, then insert entry
                SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_stats (userid,url_id,count) VALUES(%s,%s,1)",
                        array($GLOBALS['userid'], SURFBAR_GET_ID()), __FILE__, __LINE__);
@@ -878,7 +878,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
        //DEBUG_LOG(__FUNCTION__.":salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid']."");
 
        // Was that okay?
-       if (SQL_AFFECTEDROWS() == 0) {
+       if (SQL_AFFECTEDROWS() < 1) {
                // Insert missing entry!
                SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_salts (url_id,userid,last_salt) VALUES(%s, %s, '%s')",
                        array(SURFBAR_GET_ID(), $GLOBALS['userid'], SURFBAR_GET_SALT()), __FILE__, __LINE__);
index 74ba0ce258a39acad47cd8aa6d384cbe224d6128..528da4a94afb2b6b95ac47f15c86e594f54766d9 100644 (file)
@@ -216,7 +216,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) {
        $pass = GET_ADMIN_HASH($admin_login);
        if ($pass != "-1") $ret = "pass";
 
-       //* DEBUG: */ echo __FUNCTION__.":".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")<br />\n";
 
        // Check if password matches
        if (($ret == "pass") && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) {
index 8307ed99a081e2d0f9d72bcc1bc36d7f740787ff..10f003dcda6ab45110d6141a38d7f692f84abf19 100644 (file)
@@ -82,6 +82,9 @@ if (isset($_POST['ok'])) {
                                // Secure ID
                                $id = bigintval($id);
 
+                               // Revert german commata
+                               $_POST['perc'][$id] = REVERT_COMMA($_POST['perc'][$id]);
+
                                // Update entry
                                $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refdepths SET level='%s', percents='%s' WHERE id=%s LIMIT 1",
                                 array(bigintval($value), $_POST['perc'][$id], $id), __FILE__, __LINE__);
@@ -211,7 +214,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => $perc,
+                               'per' => TRANSLATE_COMMA($perc),
                        );
 
                        // Load row template and switch color
@@ -239,7 +242,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => $perc,
+                               'per' => TRANSLATE_COMMA($perc),
                        );
 
                        // Load row template and switch color
@@ -268,7 +271,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                        'sw'  => $SW,
                                        'id'  => $id,
                                        'lvl' => $lvl,
-                                       'per' => $perc,
+                                       'per' => TRANSLATE_COMMA($perc),
                                );
 
                                // Load row template and switch color
index e81f62f2496d6fe7260927dcd692c78eb4b044ce..14b4f72721c5cdf446ac5e937ef3a148195a09b7 100644 (file)
@@ -170,11 +170,15 @@ if (!empty($_GET['reg_ext'])) {
                if ($_CONFIG['verbose_sql']) {
                        // Load SQL commands in remove mode
                        $EXT_LOAD_MODE = "remove";
+                       $EXT_ALWAYS_ACTIVE = "N";
                        $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
-                       include($file);
+                       if (FILE_READABLE($file)) {
+                               // Load file
+                               include($file);
 
-                       // Generate extra table with loaded SQL commands
-                       $VERBOSE_OUT = EXTENSION_VERBOSE_TABLE($SQLs);
+                               // Generate extra table with loaded SQL commands
+                               $VERBOSE_OUT = EXTENSION_VERBOSE_TABLE($SQLs);
+                       }
                } // END - if
 
                // Prepare data for the row template
index f14b121913e27574696473725d1d20f4bb5debe5..cfd4b3ba519e4ce67751d808963cbb7984abe9f3 100644 (file)
@@ -64,7 +64,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
                if ($confirm == 1)
                {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title, action, what, descr FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT title, action, what FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%s LIMIT 1",
                         array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1)
                        {
@@ -200,8 +200,8 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
                switch ($_POST['ok'])
                {
                case "edit": // Edit menu
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET title='%s', action='%s', what='%s', descr='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                        array($menu, $_POST['sel_act'][$sel], $_POST['sel_what'][$sel], $_POST['sel_descr'][$sel], $sel), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET title='%s', action='%s', what='%s' WHERE ".$AND." AND id=%s LIMIT 1",
+                        array($menu, $_POST['sel_act'][$sel], $_POST['sel_what'][$sel], $sel), __FILE__, __LINE__);
                        break;
 
                case "del": // Delete menu
index 1acda592513399fc9c4dd27a759d394d319fa48b..860cd24d90ec630248173febf3c570942a92aae7 100644 (file)
@@ -262,6 +262,12 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
                return;
        } // END - if
 
+       // Is the refback extension there?
+       if (EXT_IS_ACTIVE("refback")) {
+               // Update refback table
+               UPDATE_REFBACK_TABLE($userid);
+       } // END - if
+
        // Write his welcome-points
        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=0 LIMIT 1",
         array(bigintval($userid)), __FILE__, __LINE__);
index 46387bf9fcfc4993b3c66da219d07e7d3e9d830a..ec7275b3c578046cbcc8113556e0543526ff8bb9 100644 (file)
@@ -86,9 +86,9 @@ while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
        // Transfer data to array for template
        $content = array(
                'lvl'    => $lvl,
-               'per'    => $per,
+               'per'    => TRANSLATE_COMMA($per),
                'points' => TRANSLATE_COMMA($points),
-               'refs'   => $REFS,
+               'refs'   => TRANSLATE_COMMA($REFS),
        );
 
        // Output row
diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php
new file mode 100644 (file)
index 0000000..280aba6
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/09/2008 *
+ * ================                             Last change: 09/09/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-refback.php                                 *
+ * -------------------------------------------------------------------- *
+ * Short description : Refback setup                                    *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Refback-Einstellungen                            *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif (!IS_MEMBER()) {
+       // User is not logged in
+       LOAD_URL("modules.php?module=index");
+} elseif ((!EXT_IS_ACTIVE("refback")) && (!IS_ADMIN())) {
+       // Extension "refback" is not active
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "refback");
+       return;
+}
+
+// Add description as navigation point
+ADD_DESCR("member", basename(__FILE__));
+
+// Was the form submitted?
+if ((isset($_POST['edit'])) && (isset($_POST['id']))) {
+       // Okay, has the user entered some values?
+       if (isset($_POST['percents'])) {
+               // Change ref-back for this direct id
+               $status = REFBACK_CHANGE_MEMBER_PERCENTS($_POST['id'], $_POST['percents']);
+
+               // Check status
+               if (isset($status['ok'])) {
+                       // No message found
+                       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_DONE);
+               } elseif (isset($status['message'])) {
+                       // Something went wrong with error message
+                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_MESSAGE, $status['message']));
+               } else {
+                       // No message found
+                       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_ERROR_EMPTY_MESSAGE);
+               }
+
+               // Insert line
+               OUTPUT_HTML("<br />");
+       } else {
+               // Read data from refback table
+               $content = GET_USER_REF_ENTRY($_POST['id']);
+
+               // Translate comma
+               $content['refback'] = TRANSLATE_COMMA($content['refback']);
+
+               // Load form for editing
+               LOAD_TEMPLATE("member_refback_edit", false, $content);
+       }
+} // END - if
+
+// Load all referal levels
+$result = SQL_QUERY_ESC("SELECT r.level, r.percents
+FROM "._MYSQL_PREFIX."_refdepths AS r
+WHERE r.level > 0
+ORDER BY r.level ASC",
+       array($GLOBALS['userid']), __FILE__, __LINE__);
+
+// Are there some entries? (Shall be!)
+if (SQL_NUMROWS($result) > 0) {
+       // List all levels
+       $OUT = "";
+       while ($content = SQL_FETCHARRAY($result)) {
+               // Init variables
+               $rows = "";
+               $counter = 0;
+               $SW = 2;
+
+               // Check for users ref in this level
+               foreach (GET_USER_REFS($GLOBALS['userid'], $content['level']) as $refRow) {
+                       // Not-deleted account is default
+                       $deleted = false;
+                       if (is_null($refRow['status'])) $deleted = true;
+
+                       // Add/"translate" more content
+                       $refRow['sw']      = $SW;
+                       $refRow['points']  = TRANSLATE_COMMA($refRow['points']);
+                       $refRow['refback'] = TRANSLATE_COMMA($refRow['refback']);
+                       $refRow['status']  = TRANSLATE_STATUS($refRow['status']);
+                       if (empty($refRow['nickname'])) $refRow['nickname'] = "---";
+
+                       // Load row template
+                       if ($deleted) {
+                               $rows .= LOAD_TEMPLATE("member_refback_list_row_deleted", true, $refRow);
+                       } else {
+                               $rows .= LOAD_TEMPLATE("member_refback_list_row", true, $refRow);
+                       }
+
+                       // Count this ref and switch color
+                       $counter++;
+                       $SW = 3 - $SW;
+               } // END - foreach
+
+               // Remember the content
+               $content['counter']  = TRANSLATE_COMMA($counter);
+               $content['percents'] = TRANSLATE_COMMA($content['percents']);
+               $content['rows']     = $rows;
+
+               // Load level template
+               $OUT .= LOAD_TEMPLATE("member_refback_list_level", true, $content);
+       } // END - while
+
+       // Load main template
+       LOAD_TEMPLATE("member_refback_list", false, $OUT);
+} else {
+       // No entries
+       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_NO_ENTRIES);
+}
+
+// Free result
+SQL_FREERESULT($result);
+
+//
+?>
index 15badd903ca0a81a7a5e81cf3d14d4dd2195c4af..65ef9187faee9137559fe933fef3865086c85f6f 100644 (file)
@@ -137,6 +137,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                        // Administrative functions
                                        require_once(PATH."inc/modules/admin/admin-inc.php");
                                } // END - if
+                               //* DEBUG: */ ADD_POINTS_REFSYSTEM(36,1000);
+                               //* DEBUG: */ die();
 
                                // Get all values
                                if (($CSS != 1) && ($CSS != -1)) {
@@ -156,7 +158,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                UPDATE_ONLINE_LIST($PHPSESSID, $GLOBALS['module'], $GLOBALS['action'], $GLOBALS['what']);
 
                                // Set default 'what' value
-                               //* DEBUG */ echo "-".$GLOBALS['module']."/".$GLOBALS['what']."-<br />\n";
+                               //* DEBUG: */ echo "-".$GLOBALS['module']."/".$GLOBALS['what']."-<br />\n";
                                if ((empty($GLOBALS['what'])) && (empty($GLOBALS['action'])) && ($CSS != 1) && ($CSS != -1)) {
                                        if ($GLOBALS['module'] == "admin") {
                                                // Set 'action' value to 'login' in admin menu
index 26e6870c0c059400f990685bfa05df85f31c44e7..186b1d43e1c678457ef27ae9e0f24ac82e7a75c6 100644 (file)
@@ -168,7 +168,7 @@ function CHECK_MODULE($mod) {
                        }
 
                        // Everthing is fine?
-                       if (SQL_AFFECTEDROWS() == 0) {
+                       if (SQL_AFFECTEDROWS() < 1) {
                                // Something bad happend!
                                return "major";
                        } // END - if
@@ -286,7 +286,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
                                $DEPTH="0";
 
                                // Handle failed logins here if not in guest
-                               //* DEBUG: */ echo __FUNCTION__.":type={$type},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$ACC_LVL}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$type},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$ACC_LVL}<br />\n";
                                if ((($type == "what") || ($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == $_CONFIG['index_home']))) && ($ACC_LVL != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
                                        // Handle failture
                                        $OUT .= HANDLE_LOGIN_FAILTURES($ACC_LVL);
@@ -476,7 +476,7 @@ function IS_ADMIN($admin="")
 
        if (!empty($valPass)) {
                // Check if password is valid
-               //* DEBUG: */ echo __FUNCTION__."*".$valPass."/".$passCookie."*<br />\n";
+               //* DEBUG: */ print __FUNCTION__."*".$valPass."/".$passCookie."*<br />\n";
                $ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == "*FAILED*") && (!EXT_IS_ACTIVE("cache"))));
        }
 
@@ -1129,26 +1129,24 @@ function GET_REF_LEVEL_PERCENTS ($level) {
  * uid         = Referral ID wich should receive...
  * points      = ... xxx points
  * send_notify = shall I send the referral an email or not?
- * rid         = inc/modules/guest/what-confirm.php need this
+ * rid         = inc/modules/guest/what-confirm.php need this (DEPRECATED???)
  * locked      = Shall I pay it to normal (false) or locked (true) points ammount?
  * add_mode    = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct"
  *               for default value will cause no referral will get points ever!!!)
  */
 function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
        global $DEPTH, $_CONFIG, $DATA, $cacheArray;
 
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
 
-       // Debug message
-       //DEBUG_LOG(__FUNCTION__.": uid={$uid},points={$points}");
-
        // When $uid = 0 add points to jackpot
        if ($uid == "0") {
                // Add points to jackpot
                ADD_JACKPOT($points);
                return;
-       }
+       } // END - if
 
        // Count up referral depth
        if (!isset($DEPTH)) {
@@ -1169,50 +1167,39 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
        $result_user = SQL_QUERY_ESC("SELECT refid, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
         array(bigintval($uid)), __FILE__, __LINE__);
 
-       //* DEBUG */ echo "+".SQL_NUMROWS($result_user).":".$points."+<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}<br />\n";
        if (SQL_NUMROWS($result_user) == 1) {
                // This is the user and his ref
                list($ref, $email) = SQL_FETCHROW($result_user);
                $cacheArray['add_uid'][$ref] = $uid;
 
-               // Debug message
-               //DEBUG_LOG(__FUNCTION__.": ref={$ref},email={$email},DEPTH={$DEPTH}");
-
                // Get percents
                $per = GET_REF_LEVEL_PERCENTS($DEPTH);
-               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},points={$points},depth={$DEPTH},per={$per},mode={$add_mode}<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},depth={$DEPTH},per={$per},mode={$add_mode}<br />\n";
 
                // Some percents found?
                if ($per > 0) {
                        // Calculate new points
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},per={$per},depth={$DEPTH}<br />\n";
                        $ref_points = $points * $per / 100;
 
                        // Pay refback here if level > 0 and in ref-mode
-                       if (($DEPTH > 0) && ($per < 100) && ($add_mode == "ref")) {
-                               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - BEFORE!<br />\n";
-                               $ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $ref_points, $DEPTH);
-                               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - AFTER!<br />\n";
+                       if ((EXT_IS_ACTIVE("refback")) && ($DEPTH > 0) && ($per < 100) && ($add_mode == "ref") && (isset($cacheArray['add_uid'][$uid]))) {
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - BEFORE!<br />\n";
+                               $ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $points, $ref_points);
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$DEPTH} - AFTER!<br />\n";
                        } // END - if
 
-                       // Debug message
-                       //DEBUG_LOG(__FUNCTION__.": percent={$per},ref_points={$ref_points}");
-
                        // Update points...
-                       //* DEBUG: */ echo __FUNCTION__.":data={$data},ref_points={$ref_points},uid={$uid},depth={$DEPTH} - UPDATE!<br />\n";
-                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth=%d LIMIT 1",
+                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth='%s' LIMIT 1",
                         array($data, $data, $ref_points, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
-
-                       // Debug log
-                       //DEBUG_LOG(__FUNCTION__.": affectedRows=".SQL_AFFECTEDROWS().",DEPTH={$DEPTH}");
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},uid={$uid},depth={$DEPTH},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />\n";
 
                        // No entry updated?
-                       if (SQL_AFFECTEDROWS() == 0) {
+                       if (SQL_AFFECTEDROWS() < 1) {
                                // First ref in this level! :-)
-                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, %s) VALUES (%s, %d, %s)",
+                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,%s,%s)",
                                 array($data, bigintval($uid), bigintval($DEPTH), $ref_points), __FILE__, __LINE__);
-
-                               // Debug log
-                               //DEBUG_LOG(__FUNCTION__.": insertedRows=".SQL_AFFECTEDROWS()."");
                        } // END - if
 
                        // Update mediadata as well
@@ -1256,6 +1243,7 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
                        // Maybe there's another ref?
                        if (($ref > 0) && ($points > 0) && ($ref != $uid) && ($add_mode == "ref")) {
                                // Then let's credit him here...
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
                                ADD_POINTS_REFSYSTEM($ref, $points, $send_notify, $ref, $locked);
                        } // END - if
                } // END - if
@@ -1263,112 +1251,7 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
 
        // Free result
        SQL_FREERESULT($result_user);
-}
-// Payback refback for refid and reduce it for current user
-function ADD_REFBACK_POINTS ($uid, $ref, $points) {
-       global $DEPTH, $cacheArray;
-
-       // Backup and reset ref depth
-       $cacheArray['depth'][$uid][$ref] = $DEPTH; $DEPTH = -1;
-
-       // Init points
-       $return = $points;
-
-       // "Walk through all refids
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$ref},points={$points}<br />\n";
-       foreach (GET_REFBACK_USERID_ARRAY($uid) as $refid) {
-               // Skip level zero or if both are the same
-               if ($uid == $refid) continue;
-
-               // Get refback percents
-               $percents = GET_REFBACK_PERCENTS($uid, $refid);
-               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$ref},refid={$refid},points={$points},percents={$percents}<br />\n";
-
-               // Some percents given?
-               if ($percents > 0) {
-                       // Get points for refback
-                       $refback = $points * $percents / 100;
-       
-                       // Add points again, but only directly
-                       //* DEBUG: */ echo __FUNCTION__.":refback={$refback}<br />\n";
-                       ADD_POINTS_REFSYSTEM($uid, $refback, false, "0", false, "direct");
-
-                       // Update refback table
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_refs SET points=points+%s WHERE userid=%s AND refid=%s LIMIT 1",
-                               array($refback, $uid, $refid), __FILE__, __LINE__);
-
-                       // Reduce points if refid is found
-                       if ($refid == $ref) {
-                               // Reduce points here!
-                               $return = $points - $refback;
-                               //* DEBUG: */ echo __FUNCTION__.":points={$return} - REDUCED<br />\n";
-                       } // END - if
-               } // END - if
-       } // END foreach
-
-       // Restore ref depth
-       $DEPTH = $cacheArray['depth'][$uid][$ref];
-
-       // Return them
-       return $return;
-}
-// "Getter" for refback percents
-function GET_REFBACK_PERCENTS ($uid, $ref) {
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$ref}<br />\n";
-       // Skip identical ids
-       if ($uid == $ref) return 0;
-
-       // Default is zero
-       $percents = 0;
-
-       // Get percents from database
-       $result = SQL_QUERY_ESC("SELECT refback FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND refid=%s LIMIT 1",
-               array($ref, $uid), __FILE__, __LINE__);
-
-       // Entry found? (Should be!)
-       if (SQL_NUMROWS($result) == 1) {
-               // Fetch percents
-               list($percents) = SQL_FETCHROW($result);
-       } else {
-               // Debug log
-               DEBUG_LOG(__FUNCTION__.": uid={$uid},ref={$ref} - No entry found! :-(");
-       }
-
-       // Free result
-       SQL_FREERESULT($result);
-
-       // Return percents
-       return $percents;
-}
-// "Getter" for userid array
-function GET_REFBACK_USERID_ARRAY ($rid) {
-       //* DEBUG: */ echo __FUNCTION__.":rid={$rid}<br />\n";
-       // Init userids
-       $userIds = array();
-
-       // Look for all
-       $result = SQL_QUERY_ESC("SELECT userid
-FROM "._MYSQL_PREFIX."_user_refs
-WHERE refid=%s
-GROUP BY level
-ORDER BY userid ASC",
-               array($rid), __FILE__, __LINE__);
-
-       // Entries found?
-       if (SQL_NUMROWS($result) > 0) {
-               // Add all
-               while (list($userid) = SQL_FETCHROW($result)) {
-                       //* DEBUG: */ echo __FUNCTION__.":rid={$rid},userid={$userid}<br />\n";
-                       $userIds[] = $userid;
-               } // END - while
-       } // END - if
-
-       // Free result
-       SQL_FREERESULT($result);
-
-       // Return array
-       //* DEBUG: */ echo __FUNCTION__.":rid={$rid},count()=".count($userIds)."<br />\n";
-       return $userIds;
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
 }
 //
 function UPDATE_REF_COUNTER ($uid) {
@@ -1376,19 +1259,19 @@ function UPDATE_REF_COUNTER ($uid) {
 
        // Make it sure referral level zero (member him-/herself) is at least selected
        if (empty($cacheArray['ref_level'][$uid])) $cacheArray['ref_level'][$uid] = 1;
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['ref_level'][$uid]}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['ref_level'][$uid]}<br />\n";
 
        // Update counter
        $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refsystem SET counter=counter+1 WHERE userid=%s AND level='%s' LIMIT 1",
                array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
 
        // When no entry was updated then we have to create it here
-       //* DEBUG: */ echo __FUNCTION__.":updated=".SQL_AFFECTEDROWS()."<br />\n";
-       if (SQL_AFFECTEDROWS() == 0) {
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS()."<br />\n";
+       if (SQL_AFFECTEDROWS() < 1) {
                // First count!
                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_refsystem (userid, level, counter) VALUES (%s,%s,1)",
                        array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
-               //* DEBUG: */ echo __FUNCTION__.":uid={$uid}<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid}<br />\n";
        } // END - if
 
        // Check for his referral
@@ -1400,118 +1283,26 @@ function UPDATE_REF_COUNTER ($uid) {
 
        // Free memory
        SQL_FREERESULT($result);
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$ref}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref}<br />\n";
 
        // When he has a referral...
        if (($ref > 0) && ($ref != $uid)) {
                // Move to next referral level and count his counter one up!
-               //* DEBUG: */ echo __FUNCTION__.":ref={$ref} - ADVANCE!<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />\n";
                $cacheArray['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
        } elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) {
                // Remove cache here
-               //* DEBUG: */ echo __FUNCTION__.":ref={$ref} - CACHE!<br />\n";
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
                if ($cacheInstance->cache_file("refsystem", true)) $cacheInstance->cache_destroy();
        }
 
        // "Walk" back here
        $cacheArray['ref_level'][$uid]--;
 
-       // Handle refback here
-       UPDATE_REFBACK_TABLE($uid);
-}
-// Update "refback table"
-function UPDATE_REFBACK_TABLE($uid)
-{
-       global $cacheArray, $cacheInstance;
-
-       // Make it sure referral level zero (member him-/herself) is at least selected
-       if (empty($cacheArray['back_level'])) $cacheArray['back_level'] = 1;
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['back_level']}<br />\n";
-
-       // Init refid
-       $cacheArray['up_refid'][$cacheArray['back_level']] = 0;
-       $old = 0; $minus = 0;
-
-       // Check for his referral
-       $result_refid = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s ORDER BY userid ASC",
-               array(bigintval($uid)), __FILE__, __LINE__);
-
-       // When no entry was updated then we have to create it here
-       //* DEBUG: */ echo __FUNCTION__.":found=".SQL_NUMROWS($result_refid)."<br />\n";
-       if (SQL_NUMROWS($result_refid) > 0) {
-               // Load all refids
-               while(list($cacheArray['up_refid'][$cacheArray['back_level']]) = SQL_FETCHROW($result_refid)) {
-                       // Remmber userid
-                       $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']]] = $uid;
-
-                       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]}<br />\n";
-                       // Refid set?
-                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (!empty($cacheArray['up_refid'][$cacheArray['back_level']]))) {
-                               // New userid?
-                               if ((isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) && (isset($cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]]))) {
-                                       // New userid!
-                                       $old = $uid;
-                                       $uid = $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]];
-                                       $minus = 1;
-                                       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},old={$old},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - NEW UID!<br />\n";
-                               } // END - if
-
-                               // Check existence
-                               $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
-                                       array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
-
-                               // Do we have no entry?
-                               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]},minus={$minus},numRows=".SQL_NUMROWS($result)." - FOUND!<br />\n";
-                               if (SQL_NUMROWS($result) == 0) {
-                                       // Insert this level
-                                       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - ADD!<br />\n";
-                                       $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_refs (userid, level, refid) VALUES (%s,%s,%s)",
-                                               array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
-
-                                       // Move to next referral level and count his counter one up!
-                                       $cacheArray['back_level']++; UPDATE_REFBACK_TABLE($cacheArray['up_refid'][($cacheArray['back_level'] - 1)]);
-                               } // END - if
-
-                               // Do we have another level here?
-                               if ((($cacheArray['back_level']-$minus) > 0) && ($old > 0)) {
-                                       // Restore old one
-                                       $uid = $old;
-
-                                       // Shall we add this as well?
-                                       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_refs WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
-                                               array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
-
-                                       // Do we have no entry?
-                                       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]},numRows=".SQL_NUMROWS($result)." - BACK!<br />\n";
-                                       if (SQL_NUMROWS($result) == 0) {
-                                               // Insert this level
-                                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_refs (userid, level, refid) VALUES (%s,%s,%s)",
-                                                       array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
-                                               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - RETURNED!<br />\n";
-                                       } // END - if
-                               } // END - if
-                       } // END - if
-               } // END - while
-
-               // Free memory
-               SQL_FREERESULT($result_refid);
+       // Handle refback here if extension is installed
+       if (EXT_IS_ACTIVE("refback")) {
+               UPDATE_REFBACK_TABLE($uid);
        } // END - if
-
-       // When he has a referral...
-       if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) {
-               // Remove cache here
-               //* DEBUG: */ echo __FUNCTION__.":uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!<br />\n";
-               if ($cacheInstance->cache_file("refback", true)) $cacheInstance->cache_destroy();
-               $cacheArray['back_cached'] = 1;
-       } // END - if
-
-       // "Walk" back here
-       $cacheArray['back_level']--;
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['back_level']} - LEVEL!<br />\n";
-
-       // Fix empty refid
-       if (!isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) $cacheArray['up_refid'][$cacheArray['back_level']-1] = 0;
-       //* DEBUG: */ echo __FUNCTION__.":uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']-1]} - BACK!<br />\n";
 }
 // Updates/extends the online list
 function UPDATE_ONLINE_LIST($SID, $mod, $act, $wht) {
@@ -1834,7 +1625,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
 
        // Remove from rallye if found
        if (EXT_IS_ACTIVE("rallye")) {
-               $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s",
+               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s",
                 array(bigintval($uid)), __FILE__, __LINE__);
        }
 
@@ -1977,7 +1768,7 @@ function MODULE_HAS_MENU($mod, $forceDb = false)
 
        // All is false by default
        $ret = false;
-       //* DEBUG: */ echo __FUNCTION__.":mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
                // Cache version is okay, so let's check the cache!
                if (isset($cacheArray['modules']['has_menu'][$mod])) {
@@ -2064,7 +1855,7 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
 
        // Get affected rows
        $affectedRows = SQL_AFFECTEDROWS();
-       //* DEBUG: */ echo __FUNCTION__.":entries={$entries},affectedRows={$affectedRows}<br />\n";
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
 
        // Rebuild cache
        REBUILD_CACHE("config", "config");
@@ -2119,6 +1910,5 @@ VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
        // Free memory
        SQL_FREERESULT($result);
 }
-
 //
 ?>
index 2bf08fc73bedbddbcd5a8932ec2173a70a01887e..e636e6481e16006c203f350f1dd7f4c4ed871c04 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
  * MA  02110-1301  USA                                                  *
  ************************************************************************/
-
+/*
+print "<pre>";
+debug_print_backtrace();
+die("</pre>");
+*/
 echo "<HTML>
 <HEAD>
 <TITLE>Protected file ".basename($_SERVER['PHP_SELF'])." - ACCESS DENIED!</TITLE>
index d4ba588826a994e16682e7c4926fa9a064674b9d..61f7bfb2fabc4b942c54b37d19db9c60dde708d6 100644 (file)
@@ -76,7 +76,6 @@ CREATE TABLE `mxchange_member_menu` (
   `sort` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,\r
   `visible` ENUM('Y','N') NOT NULL DEFAULT 'Y',\r
   `locked` ENUM('Y','N') NOT NULL DEFAULT 'Y',\r
-  `descr` blob NOT NULL,\r
   `counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,\r
   PRIMARY KEY  (`id`)\r
 ) TYPE=MyISAM;\r
index 7b614917cb7519c1848e085572d40946e41f6974..5b8266b552e379d6ade1672e21a41928fc607902 100644 (file)
@@ -1,21 +1,21 @@
-<TABLE border="0" cellspacing="0" cellpadding="0" width="99%"
-       class="admin_table dashed">
-       <TR>
-               <TD colspan="6" class="admin_title" height="30"><STRONG>{--ADMIN_LIST_REFERRALS_1--}<U>{--_UID--}</U>{--ADMIN_LIST_REFERRALS_2--}</STRONG>
-               </TD>
-       </TR>
-       <TR>
-               <TD width="5%" align="center" class="admin_header bottom2 right2"><STRONG>{--_UID--}</STRONG></TD>
-               <TD width="5%" align="center" class="admin_header bottom2 right2"><STRONG>{--REFS_COUNT--}</STRONG></TD>
-               <TD width="35%" align="center" class="admin_header bottom2 right2"><STRONG>{--SURNAME_FAMILY--}</STRONG></TD>
-               <TD width="35%" align="center" class="admin_header bottom2 right2"><STRONG>{--ADDY--}</STRONG></TD>
-               <TD width="10%" align="center" class="admin_header bottom2 right2"><STRONG>{--ACCOUNT_STATUS--}</STRONG></TD>
-               <TD width="10%" align="center" class="admin_header bottom2"><STRONG>{--MEMBER_JOINED--}</STRONG></TD>
-       </TR>
-       {!__REF_ROWS!}
-       <TR>
-               <TD colspan="6" class="admin_footer"
-                       style="padding-top: 7px; padding-bottom: 7px"><FONT
-                       class="admin_note">{--ADMIN_LIST_REFERRALS_NOTE--}</FONT></TD>
-       </TR>
+<TABLE border="0" cellspacing="0" cellpadding="0" width="99%" class="admin_table dashed">
+<TR>
+       <TD colspan="6" class="admin_title" height="30">
+               <STRONG>{--ADMIN_LIST_REFERRALS_1--}<U>$content[uid]</U>{--ADMIN_LIST_REFERRALS_2--}</STRONG>
+       </TD>
+</TR>
+<TR>
+       <TD width="5%" align="center" class="admin_header bottom2 right2"><STRONG>{--_UID--}</STRONG></TD>
+       <TD width="5%" align="center" class="admin_header bottom2 right2"><STRONG>{--REFS_COUNT--}</STRONG></TD>
+       <TD width="35%" align="center" class="admin_header bottom2 right2"><STRONG>{--SURNAME_FAMILY--}</STRONG></TD>
+       <TD width="35%" align="center" class="admin_header bottom2 right2"><STRONG>{--ADDY--}</STRONG></TD>
+       <TD width="10%" align="center" class="admin_header bottom2 right2"><STRONG>{--ACCOUNT_STATUS--}</STRONG></TD>
+       <TD width="10%" align="center" class="admin_header bottom2"><STRONG>{--MEMBER_JOINED--}</STRONG></TD>
+</TR>
+$content[rows]
+<TR>
+       <TD colspan="6" class="admin_footer" style="padding-top: 7px; padding-bottom: 7px">
+               <FONT class="admin_note">{--ADMIN_LIST_REFERRALS_NOTE--}</FONT>
+       </TD>
+</TR>
 </TABLE>
diff --git a/templates/de/html/admin/admin_list_refs_level.tpl b/templates/de/html/admin/admin_list_refs_level.tpl
new file mode 100644 (file)
index 0000000..45cd439
--- /dev/null
@@ -0,0 +1,13 @@
+<TABLE border="0" cellspacing="0" cellpadding="0" width="99%" class="admin_table dashed">
+<TR>
+       <TD colspan="6" class="admin_title" height="30">
+               <STRONG>{--ADMIN_LIST_REFERRALS_LEVEL_1--}<U>$content[level]</U>{--ADMIN_LIST_REFERRALS_LEVEL_2--}</STRONG>
+       </TD>
+</TR>
+$content[rows]
+<TR>
+       <TD colspan="6" class="admin_footer seperator">
+               &nbsp;
+       </TD>
+</TR>
+</TABLE>
index 7ba25b37bb5e326c77ea9a27d55012224d4d6284..fba5cfd2566455a95d9d38d3569f78b65f44596d 100644 (file)
@@ -1,9 +1,7 @@
 <TR>
-       <TD align="center" class="bottom2 right2 switch_sw$content[sw]"
-               align="right" valign="top">$content[u_link]&nbsp;&nbsp;</TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]" align="right" valign="top">$content[u_link]&nbsp;&nbsp;</TD>
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">$content[refs_link]</TD>
-       <TD class="bottom2 right2 switch_sw$content[sw]">&nbsp;$content[gender]
-       $content[surname] $content[family]</TD>
+       <TD class="bottom2 right2 switch_sw$content[sw]">&nbsp;$content[gender] $content[surname] $content[family]</TD>
        <TD class="bottom2 right2 switch_sw$content[sw]">&nbsp;$content[email]</TD>
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">&nbsp;$content[status]</TD>
        <TD class="bottom2 switch_sw$content[sw]">&nbsp;$content[registered]</TD>
diff --git a/templates/de/html/ext/ext_refback.tpl b/templates/de/html/ext/ext_refback.tpl
new file mode 100644 (file)
index 0000000..9302d8e
--- /dev/null
@@ -0,0 +1,8 @@
+Ref-Back ist ein Prozentsatz, der von dem Referal-Guthaben Ihrer Mitglieder
+abgezogen wird und dem geworbenen, der gerade {!POINTS!} erwirtschaftet,
+gutgeschrieben. Sobald das Mitglied Ref-Back f&uuml;r seine Referals &auml;ndert,
+erh&auml;lt der Referal eine Mail zugesandt, wie diese jetzt eingestellt ist.<br />
+<br />
+Das Mitglied kann sehen, wo es welche Referal-<strong>Verg&uuml;tungen</strong>
+an seine Referals gegeben hat. Es ist in sp&auml;teren Versionen eine &Uuml;bersicht
+f&uuml;r erhaltene Ref-Back-Gutschriften geplant.
diff --git a/templates/de/html/member/member_refback_edit.tpl b/templates/de/html/member/member_refback_edit.tpl
new file mode 100644 (file)
index 0000000..d5264fb
--- /dev/null
@@ -0,0 +1,27 @@
+<form action="{!URL!}/modules.php?module=login&amp;what=refback" method="post" style="padding-bottom:10px">
+<input type="hidden" name="id" value="$content[id]" />
+<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed" width="400">
+<tr>
+       <td align="center" class="member_header bottom2" colspan="2">
+               <strong>{--MEMBER_REFBACK_EDIT_TITLE--}</strong><br />
+               <span class="member_note">{--MEMBER_REFBACK_REFID--}: $content[refid]</span>
+       </td>
+</tr>
+<tr><td colspan="2" class="seperator" height="5">&nbsp;</td></tr>
+<tr>
+       <td width="60%" align="right" style="padding-right:5px">
+               {--MEMBER_REFBACK_PERCENTS--}:
+       </td>
+       <td width="40%">
+               <input type="text" class="member_normal" name="percents" size="6" maxlength="7" value="$content[refback]" /> %
+       </td>
+</tr>
+<tr><td colspan="2" class="seperator bottom2" height="6">&nbsp;</td></tr>
+<tr>
+       <td align="center" class="member_footer" colspan="2">
+               <input type="reset" class="member_reset" value="{--CLEAR_FORM--}" />
+               <input type="submit" class="member_submit" name="edit" value="{--MEMBER_REFBACK_EDIT_SUBMIT--}" />
+       </td>
+</tr>
+</table>
+</form>
diff --git a/templates/de/html/member/member_refback_list.tpl b/templates/de/html/member/member_refback_list.tpl
new file mode 100644 (file)
index 0000000..07835f7
--- /dev/null
@@ -0,0 +1,14 @@
+<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed" width="740">
+<tr>
+       <td align="center" class="member_header bottom2">
+               <strong>{--MEMBER_REFBACK_TITLE--}</strong>
+       </td>
+</tr>
+<tr><td class="seperator" height="5">&nbsp;</td></tr>
+$content
+<tr>
+       <td align="center" class="member_footer top2">
+               <span class="member_note">{--MEMBER_REFBACK_NOTE--}</span>
+       </td>
+</tr>
+</table>
diff --git a/templates/de/html/member/member_refback_list_level.tpl b/templates/de/html/member/member_refback_list_level.tpl
new file mode 100644 (file)
index 0000000..45e03f9
--- /dev/null
@@ -0,0 +1,35 @@
+<tr>
+       <td align="center">
+<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed" width="730">
+<tr>
+       <td align="center" class="member_header" colspan="5">
+               <strong>{--MEMBER_REFBACK_LIST_TITLE_1--}$content[level]{--MEMBER_REFBACK_LIST_TITLE_2--}$content[percents]{--MEMBER_REFBACK_LIST_TITLE_3--}</strong>
+       </td>
+</tr>
+<tr>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--MEMBER_REFBACK_REFID--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--MEMBER_REFBACK_STATUS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--MEMBER_REFBACK_PERCENTS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--MEMBER_REFBACK_POINTS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2" width="142">
+               <strong>{--MEMBER_REFBACK_EDIT--}</strong>
+       </td>
+</tr>
+$content[rows]
+<tr>
+       <td align="center" class="member_footer" colspan="5">
+               <span class="member_note">{--MEMBER_REFBACK_COUNTER_1--}$content[counter]{--MEMBER_REFBACK_COUNTER_2--}</span>
+       </td>
+</tr>
+</table>
+       </td>
+</tr>
+<tr><td class="seperator" height="5">&nbsp;</td></tr>
diff --git a/templates/de/html/member/member_refback_list_row.tpl b/templates/de/html/member/member_refback_list_row.tpl
new file mode 100644 (file)
index 0000000..64456ca
--- /dev/null
@@ -0,0 +1,20 @@
+<tr>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[refid] ($content[nickname])
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[status]
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[refback] %
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[points] {!POINTS!}
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2" style="padding:3px">
+               <form action="{!URL!}/modules.php?module=login&amp;what=refback" method="post" style="paddin-bottom:0px">
+                       <input type="hidden" name="id" value="$content[id]" />
+                       <input type="submit" name="edit" class="member_submit" value="{--MEMBER_REFBACK_EDIT_SUBMIT--}" />
+               </form>
+       </td>
+</tr>
diff --git a/templates/de/html/member/member_refback_list_row_deleted.tpl b/templates/de/html/member/member_refback_list_row_deleted.tpl
new file mode 100644 (file)
index 0000000..257b0c0
--- /dev/null
@@ -0,0 +1,20 @@
+<tr>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[refid] ($content[nickname])
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[status]
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[refback] %
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[points] {!POINTS!}
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2" style="padding:3px">
+               <form style="paddin-bottom:0px">
+                       <input type="button" name="edit" class="member_submit disabled" title="{--MEMBER_REFBACK_DELETED_TITLE--}"
+                        disabled="disabled" value="{--MEMBER_REFBACK_DELETED_SUBMIT--}" />
+               </form>
+       </td>
+</tr>