This debug message was to noisy but it is needed in development (where debug-mode...
authorRoland Häder <roland@mxchange.org>
Sun, 7 Oct 2012 10:34:28 +0000 (10:34 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 7 Oct 2012 10:34:28 +0000 (10:34 +0000)
44 files changed:
.gitattributes
inc/callback-functions.php
inc/expression-functions.php
inc/extensions-functions.php
inc/extensions/ext-bank.php
inc/extensions/ext-country.php
inc/extensions/ext-coupon.php
inc/extensions/ext-debug.php
inc/extensions/ext-grade.php
inc/extensions/ext-imprint.php
inc/extensions/ext-network.php
inc/extensions/ext-sponsor.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-theme.php
inc/extensions/ext-user.php
inc/filter/user_filter.php
inc/libs/user_functions.php
inc/modules/admin/admin-inc.php
inc/modules/member/what-points.php
inc/modules/member/what-subids.php [new file with mode: 0644]
inc/mysql-manager.php
inc/purge/purge-user.php [new file with mode: 0644]
inc/referral-functions.php
inc/xml-functions.php
install/tables.sql
templates/de/html/member/member_add_subid.tpl [new file with mode: 0644]
templates/de/html/member/member_list_user_subids.tpl [new file with mode: 0644]
templates/de/html/member/member_list_user_subids_row.tpl [new file with mode: 0644]
templates/de/html/member/member_mydata_edit.tpl
templates/xml/admin/admin_add_do_forced_ads.xml
templates/xml/admin/admin_add_do_forced_costs.xml
templates/xml/admin/admin_list_forced_ads.xml
templates/xml/admin/admin_list_forced_campaigns.xml
templates/xml/admin/admin_list_forced_costs.xml
templates/xml/admin/admin_list_grade_data.xml
templates/xml/admin/admin_list_nickname_history.xml
templates/xml/admin/admin_list_point_accounts.xml
templates/xml/admin/admin_list_surfbar_actions.xml
templates/xml/admin/admin_list_surfbar_urls.xml
templates/xml/admin/admin_unlock_surfbar_urls.xml
templates/xml/admin_list_data_template.xml
templates/xml/member/.htaccess [new file with mode: 0644]
templates/xml/member/member_add_do_subid.xml [new file with mode: 0644]
templates/xml/member/member_list_subid.xml [new file with mode: 0644]

index bb41fca68606595fed994daf3f6e601081469142..2d0949cf35fa7dbf3ebc7f945bafd7ae10dc4372 100644 (file)
@@ -723,6 +723,7 @@ inc/modules/member/what-sponsor_list.php svneol=native#text/plain
 inc/modules/member/what-start_surfbar.php svneol=native#text/plain
 inc/modules/member/what-stats.php svneol=native#text/plain
 inc/modules/member/what-stats_surfbar.php svneol=native#text/plain
+inc/modules/member/what-subids.php svneol=native#text/plain
 inc/modules/member/what-support.php svneol=native#text/plain
 inc/modules/member/what-surfbar_book.php svneol=native#text/plain
 inc/modules/member/what-surfbar_list.php svneol=native#text/plain
@@ -808,6 +809,7 @@ inc/purge/purge-inact.php svneol=native#text/plain
 inc/purge/purge-mails.php svneol=native#text/plain
 inc/purge/purge-tasks.php svneol=native#text/plain
 inc/purge/purge-unconfirmed.php svneol=native#text/plain
+inc/purge/purge-user.php svneol=native#text/plain
 inc/referal-functions.php svneol=native#text/plain
 inc/referral-functions.php svneol=native#text/plain
 inc/request-functions.php svneol=native#text/plain
@@ -1903,6 +1905,7 @@ templates/de/html/mediadata_extra_hrow.tpl svneol=native#text/plain
 templates/de/html/mediadata_extra_row.tpl svneol=native#text/plain
 templates/de/html/mediadata_extra_row2.tpl svneol=native#text/plain
 templates/de/html/member/.htaccess svneol=native#text/plain
+templates/de/html/member/member_add_subid.tpl -text
 templates/de/html/member/member_advert.tpl svneol=native#text/plain
 templates/de/html/member/member_beg.tpl svneol=native#text/plain
 templates/de/html/member/member_beg_404.tpl svneol=native#text/plain
@@ -1956,6 +1959,8 @@ templates/de/html/member/member_list_surfbar.tpl svneol=native#text/plain
 templates/de/html/member/member_list_surfbar_form.tpl svneol=native#text/plain
 templates/de/html/member/member_list_surfbar_row.tpl svneol=native#text/plain
 templates/de/html/member/member_list_surfbar_table.tpl svneol=native#text/plain
+templates/de/html/member/member_list_user_subids.tpl svneol=native#text/plain
+templates/de/html/member/member_list_user_subids_row.tpl svneol=native#text/plain
 templates/de/html/member/member_login_js.tpl svneol=native#text/plain
 templates/de/html/member/member_mail_bonus_deleted.tpl svneol=native#text/plain
 templates/de/html/member/member_mail_bonus_new.tpl svneol=native#text/plain
@@ -2187,6 +2192,7 @@ templates/en/html/register_header.tpl svneol=native#text/plain
 templates/en/html/welcome.tpl svneol=native#text/plain
 templates/xml/.htaccess svneol=native#text/plain
 templates/xml/admin/.htaccess svneol=native#text/plain
+templates/xml/member/.htaccess svneol=native#text/plain
 theme/README.txt svneol=native#text/plain
 theme/business/images/code_bg.jpg -text svneol=unset#image/jpeg
 theme/business/images/code_bg.png -text svneol=unset#image/png
index d6d2b927e52ec1bc0fa543f5ca3f1c61bdf24b5e..042781b9c1873f795de92fb6f2cb721460ccbac2 100644 (file)
@@ -49,6 +49,15 @@ function doXmlAdminEntryMetaData ($resource, $attributes) {
        } // END - if
 }
 
+// Handles the XML node 'member-entry-meta-data'
+function doXmlMemberEntryMetaData ($resource, $attributes) {
+       // There should be no attributes
+       if (count($attributes) > 0) {
+               // Please don't add any attributes to foo-list nodes
+               reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
+       } // END - if
+}
+
 // Handles the XML node 'callback-function'
 function doXmlCallbackFunction ($resource, $attributes) {
        // There are two attributes, by default
@@ -692,6 +701,15 @@ function doXmlAdminListData ($resource, $attributes) {
        } // END - if
 }
 
+// Handles the XML node 'member-list-data'
+function doXmlMemberListData ($resource, $attributes) {
+       // There should be no attributes
+       if (count($attributes) > 0) {
+               // Please don't add any attributes to foo-list nodes
+               reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
+       } // END - if
+}
+
 // Handles the XML node 'data-tables'
 function doXmlDataTables ($resource, $attributes) {
        // There should be no attributes
@@ -836,9 +854,6 @@ function doXmlWhereSelectFromListEntry ($resource, $attributes) {
        } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
                // 'CONDITION' not valid/verifyable
                reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
-       } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['LOOK-FOR'])) {
-               // 'LOOK-FOR' not valid/verifyable
-               reportBug(__FUNCTION__, __LINE__, 'Attribute LOOK-FOR does not validate. LOOK-FOR=' . $attributes['LOOK-FOR']);
        } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
                // 'CONDITION' is not known
                reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
index 82ba0ca9a33403dc99b7afd651096295efafbfd0..92e1757623d255c3cc1b2eee383261c4c22e65d9 100644 (file)
@@ -287,8 +287,11 @@ function doExpressionTemplate ($data) {
                // This is very bad and needs fixing
                reportBug(__FUNCTION__, __LINE__, 'current_template in GLOBALS not set, callbackFunction=' . $callbackFunction . ',function_exists()=' . intval(function_exists($callbackFunction)));
        } elseif (!function_exists($callbackFunction)) {
-               // Log missing function
-               logDebugMessage(__FUNCTION__, __LINE__, 'Call-back function ' . $callbackFunction . ' does not exist.');
+               // Log missing function only in debug mode
+               if (isDebugModeEnabled()) {
+                       // Log it here
+                       logDebugMessage(__FUNCTION__, __LINE__, 'Call-back function ' . $callbackFunction . ' does not exist.');
+               } // END - if
        } else {
                // Do the replacement
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']);
index dc6b67f9b4df11df30ca0907968dca731da54d43..acd01be780c418c1a35bcf3d581f8a5c5d84a0e5 100644 (file)
@@ -2035,6 +2035,62 @@ function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) {
        addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `' . $oldColumnName . '` `' . $newColumnName . '` ' . $columnSql);
 }
 
+/**
+ * Checks if given subject is found and if not, adds an SQL query to the
+ * extension registration queue.
+ */
+function registerExtensionPointsData ($subject, $columnName, $lockedMode, $paymentMethod) {
+       // Default is old extension version
+       $add = '';
+
+       // Is the extension equal or newer 0.8.9?
+       if (((isInstallationPhase()) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
+               // Then add provider
+               $add = " AND `account_provider`='EXTENSION'";
+       } // END - if
+
+       // Is the 'subject' there?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ifSqlTableExists(points_data)=' . ifSqlTableExists('points_data') . ',getExtensionMode()=' . getExtensionMode() . ',add=' . $add);
+       if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
+               // Not found so:
+               if ((isset($GLOBALS['previous_extension'][getCurrentExtensionName()])) && (!ifSqlTableExists('points_data'))) {
+                       $dummy = $GLOBALS['previous_extension'][getCurrentExtensionName()];
+                       reportBug(__FUNCTION__, __LINE__, 'previous_extension[' . gettype($dummy) . ']=' . $dummy . ',getCurrentExtensionName()=' . getCurrentExtensionName() . ' - Under development, please report this!');
+               } // END - if
+
+               // ... add an SQL query
+               addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
+                       $subject,
+                       $columnName,
+                       $lockedMode,
+                       $paymentMethod
+               ));
+       } // END - if
+}
+
+/**
+ * Checks if given subject is found and if so, adds an SQL query to the
+ * extension unregistration queue.
+ */
+function unregisterExtensionPointsData ($subject) {
+       // Default is old extension version
+       $add = '';
+
+       // Is the extension equal or newer 0.8.9?
+       if (isExtensionInstalledAndNewer('sql_patches', '0.8.9')) {
+               // Then add provider
+               $add = " AND `account_provider`='EXTENSION'";
+       } // END - if
+
+       // Is the 'subject' there?
+       if (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 1) {
+               // Found one or more, so add an SQL query
+               addExtensionSql(sprintf("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_points_data` WHERE `subject`='%s'" . $add . " LIMIT 1",
+                       $subject
+               ));
+       } // END - if
+}
+
 // Enables/disables productive mode for current extension (used only while
 // registration).
 // @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
index 7e9434efdaed3a403c8c2b842341c4b1050691e0..ee1d7287986a800acee14d693be9dc565a61f0fd 100644 (file)
@@ -73,7 +73,7 @@ switch (getExtensionMode()) {
 `account_type` ENUM('CHECK','SAVING') NOT NULL DEFAULT 'CHECK',
 `overdraft_credit` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
 PRIMARY KEY (`id`),
-UNIQUE (`pin`),
+UNIQUE INDEX (`pin`),
 INDEX `userid_type` (`userid`,`account_type`),
 INDEX (`account_created`),
 INDEX (`account_locked`),
@@ -127,7 +127,7 @@ PRIMARY KEY (`id`)",
 `tan` VARCHAR(50) NOT NULL DEFAULT '',
 `used` ENUM('Y','N') NOT NULL DEFAULT 'N',
 PRIMARY KEY (`id`),
-UNIQUE (`account_id`,`tan`)",
+UNIQUE INDEX (`account_id`,`tan`)",
                        'Bank TAN lists per user');
 
                // Admin menu queries
index 170328812d56cd70e3b840ad6cbb96869c556cf9..cdf0382a34eeaaa643785eee699ff75ff08f743b 100644 (file)
@@ -59,7 +59,7 @@ switch (getExtensionMode()) {
 `descr` VARCHAR(255) NOT NULL DEFAULT 'Deutschland',
 `is_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
 PRIMARY KEY (`id`),
-UNIQUE (`code`)",
+UNIQUE INDEX (`code`)",
                        'Country codes and their full-length descriptions');
 
                // Insert first (Germany) country
index 4a90ed792057d8c8bf4a07332aefcb126e7765c0..676a9da2f358c5071d15c87f2adebb0ec5594789 100644 (file)
@@ -78,7 +78,7 @@ PRIMARY KEY (`id`)",
 `cashed_on` TIMESTAMP NULL DEFAULT NULL,
 PRIMARY KEY (`id`),
 UNIQUE INDEX `coupon_user` (`coupon_id`,`userid`),
-UNIQUE (`coupon_code`)",
+UNIQUE INDEX (`coupon_code`)",
                        'Coupon->user connection');
 
                // Configuration entries
index 48b19796fdbd1fb7317175dcef76b1c4c74a2ac5..2775de07b7221ca4e1fa532593d49c050d29e86a 100644 (file)
@@ -95,8 +95,8 @@ INDEX (`client_id`)",
 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 `lock_spam_reason` TINYTEXT,
 PRIMARY KEY (`id`),
-UNIQUE (`key`),
-UNIQUE (`url`)",
+UNIQUE INDEX (`key`),
+UNIQUE INDEX (`url`)",
                        'Debug clients');
 
                // Add this exchange as first client
@@ -109,7 +109,7 @@ UNIQUE (`url`)",
 `client_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `log_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`id`),
-UNIQUE (`log_id`),
+UNIQUE INDEX (`log_id`),
 INDEX `client_log` (`client_id`,`log_id`)",
                        'Debug client <-> log connection');
 
index 0ec4081d60695cd907fd4eea216045eab8cd21fa..f160c29450c6071d94abcce60224223165929669 100644 (file)
@@ -58,7 +58,7 @@ switch (getExtensionMode()) {
 `grade_name` VARCHAR(255) NOT NULL DEFAULT '',
 `grade_description` TINYTEXT NOT NULL,
 `grade_parent_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
-UNIQUE (`grade_name`),
+UNIQUE INDEX (`grade_name`),
 INDEX (`grade_parent_id`),
 PRIMARY KEY (`grade_id`)",
                        'Grade data');
@@ -72,7 +72,7 @@ PRIMARY KEY (`grade_id`)",
 `reached_points` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL,
 `reached_mails` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
 `time_valid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-UNIQUE (`grade_cash_name`),
+UNIQUE INDEX (`grade_cash_name`),
 PRIMARY KEY (`cash_id`)",
                        'Data for "cashed" grades');
 
@@ -94,7 +94,7 @@ PRIMARY KEY (`connect_id`)",
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `grade_expired` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
-UNIQUE (`userid`,`grade_id`),
+UNIQUE INDEX (`userid`,`grade_id`),
 INDEX (`grade_id`),
 PRIMARY KEY (`connect_id`)",
                        'Grade<->user connection');
index a976b8da926d05a010755b772a26f0c5bfc4b8d2..af8ad211a5c76c1541c697597e004fd867fa91cf 100644 (file)
@@ -71,7 +71,7 @@ switch (getExtensionMode()) {
 `imprint_key` VARCHAR(255) NOT NULL DEFAULT '',
 `imprint_value` VARCHAR(255) NOT NULL DEFAULT '',
 PRIMARY KEY (`imprint_id`),
-UNIQUE (`imprint_key`)",
+UNIQUE INDEX (`imprint_key`)",
                        'Imprint data');
 
                // Init imprint data
index 0b1a6709a311fe37154f5cdb59314777af2b3426..7ca36e8b6ccb57548bee15582aad847a1d0a9c4f 100644 (file)
@@ -92,7 +92,7 @@ switch (getExtensionMode()) {
 `network_query_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_active` ENUM('Y','N') NOT NULL DEFAULT 'Y',
 PRIMARY KEY (`network_id`),
-UNIQUE (`network_short_name`)",
+UNIQUE INDEX (`network_short_name`)",
                        'Network data');
 
                // Types the network provider is supporting (e.g. Forced-Banner and so on)
@@ -167,7 +167,7 @@ UNIQUE INDEX `provider_type` (`network_id`, `network_vcheck_error_type`)",
 `network_translation_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `network_translation_name` VARCHAR(100) NOT NULL DEFAULT '',
 PRIMARY KEY (`network_translation_id`),
-UNIQUE (`network_translation_name`)",
+UNIQUE INDEX (`network_translation_name`)",
                        'Translations for array keys, generic data, DO NOT ALTER!');
 
                // Array-Element translation tables per type/provider
index 98eb105a8930027ab47b9d319187c2f0744bf8a3..49305ebdfb4023d86104c03cff871654c6ab1ae2 100644 (file)
@@ -92,7 +92,7 @@ switch (getExtensionMode()) {
 `last_payment` FLOAT(7,2) UNSIGNED NOT NULL DEFAULT 0.00,
 `last_currency` VARCHAR(255) NOT NULL DEFAULT '&euro;',
 PRIMARY KEY (`id`),
-UNIQUE (`hash`),
+UNIQUE INDEX (`hash`),
 INDEX (`refid`),
 INDEX (`email`)",
                        'Main sponsor data');
@@ -153,7 +153,7 @@ INDEX (`ext_name`)",
 `sort` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`id`),
 UNIQUE INDEX `action_what` (`action`,`what`),
-UNIQUE (`what`),
+UNIQUE INDEX (`what`),
 INDEX (`action`)",
                        'Sponsor menu');
                //
index c0a268cc53e9640b871b977ddd51fabd20725e5a..c90cdc548b75b97ddb3206d4d32941c6e2f5d604 100644 (file)
@@ -398,7 +398,7 @@ INDEX (`la_what`)",
 `la_posx` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `la_posy` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`id`),
-UNIQUE (`la_id`),
+UNIQUE INDEX (`la_id`),
 INDEX (`la_posx`),
 INDEX (`la_posy`)",
                                        'LAS position and title data');
index d8ead4b10ee3471958ea002dfa523612a3de7acd..2df24a983b5b7324a989a58eaac33c6866cbc18b 100644 (file)
@@ -129,7 +129,7 @@ switch (getExtensionMode()) {
 `theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
 `theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0.0',
 PRIMARY KEY (`id`),
-UNIQUE (`theme_path`),
+UNIQUE INDEX (`theme_path`),
 INDEX (`theme_active`)", 'Themes');
 
                                // Admin menu
index 9d8e7163ab8e7adbd43f5571d0e6f85bc4218132..9e1ed4d56f4bb63e8220d3d132097d4d426b00cf 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.5.2');
+setThisExtensionVersion('0.5.3');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -97,7 +97,7 @@ INDEX (`cat_id`)",
 `login_failures` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `last_failure` TIMESTAMP NULL DEFAULT NULL,
 PRIMARY KEY (`userid`),
-UNIQUE (`user_hash`),
+UNIQUE INDEX (`user_hash`),
 INDEX (`refid`),
 INDEX `status_mails` (`status`,`max_mails`)",
                        'Main user data');
@@ -180,7 +180,10 @@ INDEX (`stats_type`)",
                addDropTableSql('user_refs');
                addDropTableSql('user_stats');
                addDropTableSql('user_stats_data');
+               addDropTableSql('user_subids');
+               addDropTableSql('subid_log');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('subids')");
 
                // Register new filters for gathering points
                unregisterFilter(__FILE__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun());
@@ -191,6 +194,8 @@ INDEX (`stats_type`)",
                unregisterFilter(__FILE__, __LINE__, 'user_inclusion_sql', 'TESTER_USER_INCLUSION_SQL', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'convert_user_data_columns', 'ADD_USER_DATA_CONVERT_SQL_COLUMNS', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_refid_validation', 'HANDLE_USER_SUBID', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -378,7 +383,7 @@ INDEX (`userid`)",
 
                        case '0.3.6': // SQL queries for v0.3.6
                                addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` DROP INDEX `userid`');
-                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` ADD UNIQUE INDEX `userid_catid` (`userid`,`cat_id`)');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` ADD UNIQUE `userid_catid` (`userid`,`cat_id`)');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
@@ -469,7 +474,7 @@ INDEX (`userid`)",
 `level` smallINT(6) UNSIGNED NOT NULL DEFAULT 0,
 `refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`id`),
-UNIQUE INDEX `user_refid` (`userid`,`level`,`refid`),
+UNIQUE `user_refid` (`userid`,`level`,`refid`),
 INDEX (`level`),
 INDEX (`refid`)",
                                        'User referrals');
@@ -570,6 +575,54 @@ INDEX (`refid`)",
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter zum Hinzuf&uuml;gen von SQL-Spalten f&uuml;r die Mitgliederanmeldung hinzugef&uuml;gt.");
                                break;
+
+                       case '0.5.3': // SQL queries for v0.5.3
+                               // Register filter
+                               registerFilter(__FILE__, __LINE__, 'post_refid_validation', 'HANDLE_USER_SUBID', false, true, isExtensionDryRun());
+                               registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', false, true, isExtensionDryRun());
+
+                               // Admin menu
+                               addAdminMenuSql('user', 'list_user_subid', 'Sub-Ids', 'Listet alle pro vom Mitglied eingegebenen Sub-Ids und ermittelten Referral-URLs auf.', 7);
+
+                               // Member menu
+                               addMemberMenuSql('extras', 'subids', 'Sub-Id Tracking', 4);
+
+                               // Add table for subids
+                               addDropTableSql('user_subids');
+                               addCreateTableSql('user_subids', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`subid` VARCHAR(255) NOT NULL DEFAULT '',
+`subid_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+UNIQUE `user_subid` (`userid`, `subid`),
+INDEX (`subid`)",
+                                       'User sub ids');
+
+                               // Add table for subid logging
+                               addDropTableSql('subid_log');
+                               addCreateTableSql('subid_log', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`subid` VARCHAR(255) NOT NULL DEFAULT '',
+`referral_url` TINYTEXT,
+`remote_address` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+`entry_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`refid`),
+INDEX (`subid`)",
+                                       'Sub id logging');
+
+                               // For saving used subid in user_data table
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `subid` VARCHAR(255) NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD INDEX (`subid`)');
+
+                               // Configuration entry for purging old subid logs (7 days default)
+                               addConfigAddSql('user_subid_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 7));
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter, Datenbanktabelle und Men&uuml;punkte f&uuml;r SubId-Tracking hinzugef&uuml;gt.");
+                               break;
                } // END - switch
                break;
 
index 95f91b3df5aa24147397046fa5f009637200faec..1040aaee4e5f280d7c3103a9b4156553ffc558d9 100644 (file)
@@ -147,5 +147,31 @@ function FILTER_ADD_USER_DATA_CONVERT_SQL_COLUMNS ($sql) {
        return $sql;
 }
 
+// Filter for handling user subids (called by referral link)
+function FILTER_HANDLE_USER_SUBID ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
+       return $filterData;
+}
+
+// Filter for adding SQL columns on user registration for subid
+function FILTER_SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Is the sub id set in session?
+       if (isSessionVariableSet('subid')) {
+               // Okay, add subid here
+               addExtraRegistrationColumns(', `subid`');
+               addExtraRegistrationData(", '" . getSession('subid') . "'");
+       } // END - if
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
 // [EOF]
 ?>
index 566c762b0c3752b84821dd0849dcd09c4ca36fe9..75f0edf54bb65790ab68a85e30c2815055d96fbf 100644 (file)
@@ -796,6 +796,33 @@ function createTesterUserAccount () {
        return $isCreated;
 }
 
+// Checks whether the given sub id is fused by current member
+function isMemberSubIdFree ($subId) {
+       // Check it
+       $isFree = (countSumTotalData(getMemberId(), 'user_subids', 'id', 'userid', true, sprintf(" AND `subid`='%s'", $subId)) == 0);
+
+       // Return result
+       return $isFree;
+}
+
+// Prepares given sub id for storage in database
+function prepareSubId ($subId) {
+       // First convert any spaces/dashes to underscores
+       $subId = str_replace(' ', '_', str_replace('-', '_', $subId));
+
+       // Then filter out any unwanted characters
+       $subId = preg_replace('/([^a-zA-Z0-9_])/', '', $subId);
+
+       // Then Check if it is available
+       if (!isMemberSubIdFree($subId)) {
+               // Is not free
+               $subId = false;
+       } // END - if
+
+       // Return prepared sub id
+       return $subId;
+}
+
 //-----------------------------------------------------------------------------
 //                                EL code functions
 //-----------------------------------------------------------------------------
@@ -883,6 +910,17 @@ function doTemplateDisplayUsername ($template, $clear = false, $userid = NULL) {
        return $GLOBALS[__FUNCTION__][$userid];
 }
 
+// ----------------------------------------------------------------------------
+//                             XML call-back functions
+// ----------------------------------------------------------------------------
+
+// For 'doing' add subid, the column-index is required
+function addXmlSpecialMemberAddDoSubid () {
+       // So set it all here
+       $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction']  = 'column';
+       $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column';
+}
+
 // ----------------------------------------------------------------------------
 //                 Wrapper functions for configuration entries
 // ----------------------------------------------------------------------------
index 4de2f33ea3afdf8c5d8026e020f6a8312c20bee4..f2cae6f2983c341266b17f005086d3d1a8eb93c5 100644 (file)
@@ -1323,78 +1323,11 @@ function adminUndeleteEntriesConfirm ($tableName, $columns = array(), $filterFun
 
 // Adds a given entry to the database
 function adminAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
-       //* DEBUG: */ die('columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,POST=<pre>'.print_r($_POST,true).'</pre>');
-       // Verify that tableName and columns are not empty
-       if ((!is_array($tableName)) || (count($tableName) != 1)) {
-               // No tableName specified
-               reportBug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array: userIdColumn=' . $userIdColumn);
-       } elseif (count($columns) == 0) {
-               // No columns specified
-               reportBug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML.');
-       }
-
-       // Init columns and value elements
-       $sqlColumns = array();
-       $sqlValues  = array();
-
-       // Do we have "time columns"?
-       if (count($timeColumns) > 0) {
-               // Then "walk" through all entries
-               foreach ($timeColumns as $column) {
-                       // Convert all (possible) selections
-                       convertSelectionsToEpocheTimeInPostData($column . '_ye');
-               } // END - foreach
-       } // END - if
-
-       // Add columns and values
-       foreach ($columns as $key => $columnName) {
-               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',columnName=' . $columnName);
-               // Is columnIndex set?
-               if (!is_null($columnIndex)) {
-                       // Check conditions
-                       //* DEBUG: */ die('columnIndex=<pre>'.print_r($columnIndex,true).'</pre>'.debug_get_printable_backtrace());
-                       assert((is_array($columnName)) && (isset($columnName[$columnIndex])));
-
-                       // Then use that index "blindly"
-                       $columnName = $columnName[$columnIndex];
-               } // END - if
-
-               // Debug message
-               /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',columnName[' . gettype($columnName) . ']=' . $columnName . ',filterFunctions=' . $filterFunctions[$key] . ',extraValues=' . intval(isset($extraValues[$key])) . ',extraValuesName=' . intval(isset($extraValues[$columnName . '_list'])) . '<br />');
-
-               // Copy entry securely to the final arrays
-               $sqlColumns[$key] = SQL_ESCAPE($columnName);
-               $sqlValues[$key]  = SQL_ESCAPE(postRequestElement($columnName));
-
-               // Send data through the filter function if found
-               if ((isset($filterFunctions[$key])) && (isset($extraValues[$key . '_list']))) {
-                       // Filter function set!
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
-                       $sqlValues[$key] = call_user_func_array($filterFunctions[$key], merge_array(array($columnName), $extraValues[$key . '_list']));
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
-               } elseif ((isset($filterFunctions[$key])) && (!empty($filterFunctions[$key]))) {
-                       // Run through an extra filter
-                       /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
-                       $sqlValues[$key] = handleExtraValues($filterFunctions[$key], $sqlValues[$key], '');
-                       /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
-               }
-
-               // Is the value not a number?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key]);
-               if (($sqlValues[$key] != 'NULL') && (is_string($sqlValues[$key]))) {
-                       // Add quotes around it
-                       $sqlValues[$key] = chr(39) . $sqlValues[$key] . chr(39);
-               } // END - if
-       } // END - foreach
-
-       // Build the SQL query
-       $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName[0] . '` (`' . implode('`,`', $sqlColumns) . "`) VALUES (" . implode(',', $sqlValues) . ')';
-
-       // Run the SQL query
-       SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+       // Call inner function
+       doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex);
 
        // Entry has been added?
-       if (!SQL_HASZEROAFFECTED()) {
+       if ((!SQL_HASZEROAFFECTED()) && ($GLOBALS['__XML_PARSE_RESULT'] === true)) {
                // Display success message
                displayMessage('{--ADMIN_ENTRY_ADDED--}');
        } else {
@@ -1403,140 +1336,6 @@ function adminAddEntries ($tableName, $columns = array(), $filterFunctions = arr
        }
 }
 
-// List all given rows (callback function from XML)
-function adminListEntries ($tableTemplate, $rowTemplate, $noEntryMessageId, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters = array(), $conditions = array()) {
-       // Verify that tableName and columns are not empty
-       if ((!is_array($tableName)) || (count($tableName) != 1)) {
-               // No tableName specified
-               reportBug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate);
-       } elseif (count($columns) == 0) {
-               // No columns specified
-               reportBug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]);
-       }
-
-       // This is the minimum query, so at least columns and tableName must have entries
-       $SQL = 'SELECT ';
-
-       // Get the sql part back from given array
-       $SQL .= getSqlPartFromXmlArray($columns);
-
-       // Remove last commata and add FROM statement
-       $SQL .= ' FROM `{?_MYSQL_PREFIX?}_' . $tableName[0] . '`';
-
-       // Do we have entries from whereColumns to add?
-       if (count($whereColumns) > 0) {
-               // Then add these as well
-               if (count($whereColumns) == 1) {
-                       // One entry found
-                       $SQL .= ' WHERE ';
-
-                       // Table/alias included?
-                       if (!empty($whereColumns[0]['table'])) {
-                               // Add it as well
-                               $SQL .= $whereColumns[0]['table'] . '.';
-                       } // END - if
-
-                       // Add the rest
-                       $SQL .= '`' . $whereColumns[0]['column'] . '`' . $whereColumns[0]['condition'] . chr(39) . $whereColumns[0]['look_for'] . chr(39);
-               } elseif ((count($whereColumns > 1)) && (count($conditions) > 0)) {
-                       // More than one "WHERE" + condition found
-                       foreach ($whereColumns as $idx => $columnArray) {
-                               // Default is WHERE
-                               $condition = 'WHERE';
-
-                               // Is the condition element there?
-                               if (isset($conditions[$columnArray['column']])) {
-                                       // Assume the condition
-                                       $condition = $conditions[$columnArray['column']];
-                               } // END - if
-
-                               // Add to SQL query
-                               $SQL .= ' ' . $condition;
-
-                               // Table/alias included?
-                               if (!empty($whereColumns[$idx]['table'])) {
-                                       // Add it as well
-                                       $SQL .= $whereColumns[$idx]['table'] . '.';
-                               } // END - if
-
-                               // Add the rest
-                               $SQL .= '`' . $whereColumns[$idx]['column'] . '`' . $whereColumns[$idx]['condition'] . chr(39) . convertDollarDataToGetElement($whereColumns[$idx]['look_for']) . chr(39);
-                       } // END - foreach
-               } else {
-                       // Did not set $conditions
-                       reportBug(__FUNCTION__, __LINE__, 'Supplied more than &quot;whereColumns&quot; entries but no conditions! Please fix your XML template.');
-               }
-       } // END - if
-
-       // Do we have entries from orderByColumns to add?
-       if (count($orderByColumns) > 0) {
-               // Add them as well
-               $SQL .= ' ORDER BY ';
-               foreach ($orderByColumns as $orderByColumn => $array) {
-                       // Get keys (table/alias) and values (sorting itself)
-                       $table   = trim(implode('', array_keys($array)));
-                       $sorting = trim(implode('', array_keys($array)));
-
-                       // table/alias can be omitted
-                       if (!empty($table)) {
-                               // table/alias is given
-                               $SQL .= $table . '.';
-                       } // END - if
-
-                       // Add order-by column
-                       $SQL .= '`' . $orderByColumn . '` ' . $sorting . ',';
-               } // END - foreach
-
-               // Remove last column
-               $SQL = substr($SQL, 0, -1);
-       } // END - if
-
-       // Now handle all over to the inner function which will execute the listing
-       doAdminListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters);
-}
-
-// Do the listing of entries
-function doAdminListEntries ($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters = array()) {
-       // Run the SQL query
-       $result = SQL_QUERY($SQL, __FUNCTION__, __LINE__);
-
-       // Do we have some URLs left?
-       if (!SQL_HASZERONUMS($result)) {
-               // List all URLs
-               $OUT = '';
-               while ($content = SQL_FETCHARRAY($result)) {
-                       // "Translate" content
-                       foreach ($callbackColumns as $columnName => $callbackName) {
-                               // Fill the callback arguments
-                               $args = array($content[$columnName]);
-
-                               // Do we have more to add?
-                               if (isset($extraParameters[$columnName])) {
-                                       // Add them as well
-                                       $args = merge_array($args, $extraParameters[$columnName]);
-                               } // END - if
-
-                               // Call the callback-function
-                               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'callbackFunction=' . $callbackName . ',args=<pre>'.print_r($args, true).'</pre>');
-                               // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
-                               $content[$columnName] = call_user_func_array($callbackName, $args);
-                       } // END - foreach
-
-                       // Load row template
-                       $OUT .= loadTemplate(trim($rowTemplate[0]), true, $content);
-               } // END - while
-
-               // Load main template
-               loadTemplate(trim($tableTemplate[0]), false, $OUT);
-       } else {
-               // No URLs in surfbar
-               displayMessage('{--' .$noEntryMessageId[0] . '--}');
-       }
-
-       // Free result
-       SQL_FREERESULT($result);
-}
-
 // Checks proxy settins by fetching check-updates3.php from mxchange.org
 function adminTestProxySettings ($settingsArray) {
        // Set temporary the new settings
index 6b64c1a8436614d77b9eb822feb9498a187f962d..7975df0833ab8eef7cec152aac50ab1ae3384f8f 100644 (file)
@@ -189,6 +189,7 @@ if (isExtensionActive('user')) {
        displayMessage('{--PROBLEM_POINTS_OVERVIEW_UNAVAILABLE--}');
 }
 
+// Is ext-payout installed?
 if (isExtensionActive('payout')) {
        // Payput extension is installed and active so we can check if the user has enougth points
        outputPayoutList($content['part_points'] - getUserData('used_points'));
diff --git a/inc/modules/member/what-subids.php b/inc/modules/member/what-subids.php
new file mode 100644 (file)
index 0000000..3ca4364
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/06/2012 *
+ * ===================                          Last change: 10/06/2012 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-subids.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Lists and manages member's own sub ids           *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Auflisten und verwalten der Mitglied-SubIds      *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       exit();
+} elseif (!isMember()) {
+       redirectToIndexMemberOnlyModule();
+}
+
+// Add description as navigation point
+addYouAreHereLink('member', __FILE__);
+
+// Continue only if the proper extension is active (admins can always continue)
+if ((!isExtensionActive('user')) && (!isAdmin())) {
+       // Required extension ext-user not active
+       displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}');
+
+       // Abort here
+       return;
+} // END - if
+
+// By default show the list...
+$show = true;
+
+// Check for 'url_id' element
+//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isFormSent()=' . intval(isFormSent('add_subid')) . ',ifPostContainsSelections()=' . intval(ifPostContainsSelections()) . ',countRequestPost()=' . countRequestPost());
+if ((!isFormSent('add_subid')) && ((!ifPostContainsSelections()) || (countRequestPost() == 0))) {
+       // Not found so output message
+       displayMessage('{--MEMBER_SUBID_NO_SELECTIONS--}');
+
+       // Abort here
+       return;
+} // END - if
+
+// Edit or delete button hit?
+if (isFormSent('add_subid')) {
+       // Add new sub id
+       showEntriesByXmlCallback('member_add_do_subid');
+} elseif (isFormSent('edit')) {
+       // Show entries for editing
+       showEntriesByXmlCallback('member_edit_show_subid');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_edit')) {
+       // Change data of entries
+       showEntriesByXmlCallback('member_edit_do_subid');
+} elseif (isFormSent('delete')) {
+       // Show entries for deletion
+       showEntriesByXmlCallback('member_delete_show_subid');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_delete')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('member_delete_do_subid');
+}
+
+// Show entries?
+if ($show === false) {
+       // No, a form has already been show
+       return false;
+} // END - if
+
+// List all campaigns
+showEntriesByXmlCallback('member_list_subid');
+
+// Display form for adding a sub id
+loadTemplate('member_add_subid');
+
+// [EOF]
+?>
index 8d55ecfb3330bb058f7eda0a3f895f6c714ef03b..a21023e06e62be0ddedacffaf00d1225d36f3afc 100644 (file)
@@ -1798,60 +1798,248 @@ LIMIT 1",
        }
 }
 
-/**
- * Checks if given subject is found and if not, adds an SQL query to the
- * extension registration queue.
- */
-function registerExtensionPointsData ($subject, $columnName, $lockedMode, $paymentMethod) {
-       // Default is old extension version
-       $add = '';
+// List all given rows (callback function from XML)
+function doGenericListEntries ($tableTemplate, $rowTemplate, $noEntryMessageId, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters = array(), $conditions = array()) {
+       // Verify that tableName and columns are not empty
+       if ((!is_array($tableName)) || (count($tableName) != 1)) {
+               // No tableName specified
+               reportBug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate);
+       } elseif (count($columns) == 0) {
+               // No columns specified
+               reportBug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]);
+       }
+
+       // This is the minimum query, so at least columns and tableName must have entries
+       $SQL = 'SELECT ';
 
-       // Is the extension equal or newer 0.8.9?
-       if (((isInstallationPhase()) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
-               // Then add provider
-               $add = " AND `account_provider`='EXTENSION'";
+       // Get the sql part back from given array
+       $SQL .= getSqlPartFromXmlArray($columns);
+
+       // Remove last commata and add FROM statement
+       $SQL .= ' FROM `{?_MYSQL_PREFIX?}_' . $tableName[0] . '`';
+
+       // Do we have entries from whereColumns to add?
+       if (count($whereColumns) > 0) {
+               // Then add these as well
+               if (count($whereColumns) == 1) {
+                       // One entry found
+                       $SQL .= ' WHERE ';
+
+                       // Table/alias included?
+                       if (!empty($whereColumns[0]['table'])) {
+                               // Add it as well
+                               $SQL .= $whereColumns[0]['table'] . '.';
+                       } // END - if
+
+                       // Add the rest
+                       $SQL .= '`' . $whereColumns[0]['column'] . '`' . $whereColumns[0]['condition'] . chr(39) . $whereColumns[0]['look_for'] . chr(39);
+               } elseif ((count($whereColumns > 1)) && (count($conditions) > 0)) {
+                       // More than one "WHERE" + condition found
+                       foreach ($whereColumns as $idx => $columnArray) {
+                               // Default is WHERE
+                               $condition = 'WHERE';
+
+                               // Is the condition element there?
+                               if (isset($conditions[$columnArray['column']])) {
+                                       // Assume the condition
+                                       $condition = $conditions[$columnArray['column']];
+                               } // END - if
+
+                               // Add to SQL query
+                               $SQL .= ' ' . $condition;
+
+                               // Table/alias included?
+                               if (!empty($whereColumns[$idx]['table'])) {
+                                       // Add it as well
+                                       $SQL .= $whereColumns[$idx]['table'] . '.';
+                               } // END - if
+
+                               // Add the rest
+                               $SQL .= '`' . $whereColumns[$idx]['column'] . '`' . $whereColumns[$idx]['condition'] . chr(39) . convertDollarDataToGetElement($whereColumns[$idx]['look_for']) . chr(39);
+                       } // END - foreach
+               } else {
+                       // Did not set $conditions
+                       reportBug(__FUNCTION__, __LINE__, 'Supplied more than &quot;whereColumns&quot; entries but no conditions! Please fix your XML template.');
+               }
        } // END - if
 
-       // Is the 'subject' there?
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ifSqlTableExists(points_data)=' . ifSqlTableExists('points_data') . ',getExtensionMode()=' . getExtensionMode() . ',add=' . $add);
-       if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
-               // Not found so:
-               if ((isset($GLOBALS['previous_extension'][getCurrentExtensionName()])) && (!ifSqlTableExists('points_data'))) {
-                       $dummy = $GLOBALS['previous_extension'][getCurrentExtensionName()];
-                       reportBug(__FUNCTION__, __LINE__, 'previous_extension[' . gettype($dummy) . ']=' . $dummy . ',getCurrentExtensionName()=' . getCurrentExtensionName() . ' - Under development, please report this!');
-               } // END - if
+       // Do we have entries from orderByColumns to add?
+       if (count($orderByColumns) > 0) {
+               // Add them as well
+               $SQL .= ' ORDER BY ';
+               foreach ($orderByColumns as $orderByColumn => $array) {
+                       // Get keys (table/alias) and values (sorting itself)
+                       $table   = trim(implode('', array_keys($array)));
+                       $sorting = trim(implode('', array_keys($array)));
+
+                       // table/alias can be omitted
+                       if (!empty($table)) {
+                               // table/alias is given
+                               $SQL .= $table . '.';
+                       } // END - if
 
-               // ... add an SQL query
-               addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
-                       $subject,
-                       $columnName,
-                       $lockedMode,
-                       $paymentMethod
-               ));
+                       // Add order-by column
+                       $SQL .= '`' . $orderByColumn . '` ' . $sorting . ',';
+               } // END - foreach
+
+               // Remove last column
+               $SQL = substr($SQL, 0, -1);
        } // END - if
+
+       // Now handle all over to the inner function which will execute the listing
+       doListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters);
 }
 
-/**
- * Checks if given subject is found and if so, adds an SQL query to the
- * extension unregistration queue.
- */
-function unregisterExtensionPointsData ($subject) {
-       // Default is old extension version
-       $add = '';
+// Do the listing of entries
+function doListEntries ($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters = array()) {
+       // Run the SQL query
+       $result = SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+
+       // Do we have some URLs left?
+       if (!SQL_HASZERONUMS($result)) {
+               // List all URLs
+               $OUT = '';
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // "Translate" content
+                       foreach ($callbackColumns as $columnName => $callbackName) {
+                               // Fill the callback arguments
+                               $args = array($content[$columnName]);
+
+                               // Do we have more to add?
+                               if (isset($extraParameters[$columnName])) {
+                                       // Add them as well
+                                       $args = merge_array($args, $extraParameters[$columnName]);
+                               } // END - if
+
+                               // Call the callback-function
+                               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'callbackFunction=' . $callbackName . ',args=<pre>'.print_r($args, true).'</pre>');
+                               // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
+                               $content[$columnName] = call_user_func_array($callbackName, $args);
+                       } // END - foreach
 
-       // Is the extension equal or newer 0.8.9?
-       if (isExtensionInstalledAndNewer('sql_patches', '0.8.9')) {
-               // Then add provider
-               $add = " AND `account_provider`='EXTENSION'";
+                       // Load row template
+                       $OUT .= loadTemplate(trim($rowTemplate[0]), true, $content);
+               } // END - while
+
+               // Load main template
+               loadTemplate(trim($tableTemplate[0]), false, $OUT);
+       } else {
+               // No URLs in surfbar
+               displayMessage('{--' .$noEntryMessageId[0] . '--}');
+       }
+
+       // Free result
+       SQL_FREERESULT($result);
+}
+
+// Adds a given entry to the database
+function doGenericAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
+       //* DEBUG: */ die('columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,POST=<pre>'.print_r($_POST,true).'</pre>');
+       // Verify that tableName and columns are not empty
+       if ((!is_array($tableName)) || (count($tableName) != 1)) {
+               // No tableName specified
+               reportBug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array: userIdColumn=' . $userIdColumn);
+       } elseif (count($columns) == 0) {
+               // No columns specified
+               reportBug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML.');
+       }
+
+       // Init columns and value elements
+       $sqlColumns = array();
+       $sqlValues  = array();
+
+       // Default is that all went fine
+       $GLOBALS['__XML_PARSE_RESULT'] = true;
+
+       // Do we have "time columns"?
+       if (count($timeColumns) > 0) {
+               // Then "walk" through all entries
+               foreach ($timeColumns as $column) {
+                       // Convert all (possible) selections
+                       convertSelectionsToEpocheTimeInPostData($column . '_ye');
+               } // END - foreach
+       } // END - if
+
+       // Add columns and values
+       foreach ($columns as $key => $columnName) {
+               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',columnName=' . $columnName);
+               // Is columnIndex set?
+               if (!is_null($columnIndex)) {
+                       // Check conditions
+                       //* DEBUG: */ die('columnIndex=<pre>'.print_r($columnIndex,true).'</pre>'.debug_get_printable_backtrace());
+                       assert((is_array($columnName)) && (is_string($columnIndex)) && (isset($columnName[$columnIndex])));
+
+                       // Then use that index "blindly"
+                       $columnName = $columnName[$columnIndex];
+               } // END - if
+
+               // Debug message
+               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',columnName[' . gettype($columnName) . ']=' . $columnName . ',filterFunctions=' . $filterFunctions[$key] . ',extraValues=' . intval(isset($extraValues[$key])) . ',extraValuesName=' . intval(isset($extraValues[$columnName . '_list'])) . '<br />');
+
+               // Copy entry securely to the final arrays
+               $sqlColumns[$key] = SQL_ESCAPE($columnName);
+               $sqlValues[$key]  = SQL_ESCAPE(postRequestElement($columnName));
+
+               // Send data through the filter function if found
+               if ((isset($filterFunctions[$key])) && (isset($extraValues[$key . '_list']))) {
+                       // Filter function set!
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
+                       $sqlValues[$key] = call_user_func_array($filterFunctions[$key], merge_array(array($columnName), $extraValues[$key . '_list']));
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
+               } elseif ((isset($filterFunctions[$key])) && (!empty($filterFunctions[$key]))) {
+                       // Run through an extra filter
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
+                       $sqlValues[$key] = handleExtraValues($filterFunctions[$key], $sqlValues[$key], '');
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
+               }
+
+               // Is the value not a number?
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key]);
+               if (($sqlValues[$key] != 'NULL') && (is_string($sqlValues[$key]))) {
+                       // Add quotes around it
+                       $sqlValues[$key] = chr(39) . $sqlValues[$key] . chr(39);
+               } // END - if
+
+               // Is the value false?
+               if ($sqlValues[$key] === false) {
+                       // One "parser" didn't like it
+                       $GLOBALS['__XML_PARSE_RESULT'] = false;
+                       break;
+               } // END - if
+       } // END - foreach
+
+       // If all values are okay, continue
+       if ($sqlValues[$key] !== false) {
+               // Build the SQL query
+               $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName[0] . '` (`' . implode('`,`', $sqlColumns) . "`) VALUES (" . implode(',', $sqlValues) . ')';
+
+               // Run the SQL query
+               SQL_QUERY($SQL, __FUNCTION__, __LINE__);
        } // END - if
+}
 
-       // Is the 'subject' there?
-       if (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 1) {
-               // Found one or more, so add an SQL query
-               addExtensionSql(sprintf("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_points_data` WHERE `subject`='%s'" . $add . " LIMIT 1",
-                       $subject
-               ));
+// Adds a given entry to the database
+function memberAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
+       // Is it a member?
+       if (!isMember()) {
+               // Then abort here
+               return false;
        } // END - if
+
+       // Set POST data generic userid
+       setPostRequestElement('userid', getMemberId());
+
+       // Call inner function
+       doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex);
+
+       // Entry has been added?
+       if ((!SQL_HASZEROAFFECTED()) && ($GLOBALS['__XML_PARSE_RESULT'] === true)) {
+               // Display success message
+               displayMessage('{--MEMBER_ENTRY_ADDED--}');
+       } else {
+               // Display failed message
+               displayMessage('{--MEMBER_ENTRY_NOT_ADDED--}');
+       }
 }
 
 // [EOF]
diff --git a/inc/purge/purge-user.php b/inc/purge/purge-user.php
new file mode 100644 (file)
index 0000000..3e4850c
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/06/2012 *
+ * ===================                          Last change: 10/06/2012 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : purge-user.php                                   *
+ * -------------------------------------------------------------------- *
+ * Short description : Purging of user logs                             *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Bereinigung von Mitgliederlogbuechern            *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} // END - if
+
+// Abort if autopurge is not active or disabled by admin
+if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+       // Abort here
+       return false;
+} // END - if
+
+// [EOF]
+?>
index 667a25e0d4725677bc84bd09f0a38c5e6f548569..04c32fa24049af1ba4d2b94ba2c2660b5373d45c 100644 (file)
@@ -812,12 +812,10 @@ function determineReferralId () {
        if (isReferralIdValid()) {
                // Do not determine it, just return it
                return getReferralId();
-       } // END - if
-
-       // Skip this in non-html-mode and outside ref.php
-       if ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) {
+       } elseif ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) {
+               // Skip this in non-html-mode and outside ref.php
                return false;
-       } // END - if
+       }
 
        // Check if refid is set
        if (isReferralIdValid()) {
@@ -833,7 +831,7 @@ function determineReferralId () {
                setReferralId(secureString(getRequestElement('refid')));
        } elseif (isGetRequestElementSet('ref')) {
                // Set refid=ref (the referral link uses such variable)
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestElement('refid') . ')');
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestElement('ref') . ')');
                setReferralId(secureString(getRequestElement('ref')));
        } elseif ((isGetRequestElementSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
                // The variable user comes from  click.php
@@ -900,6 +898,9 @@ function determineReferralId () {
                setSession('refid', getReferralId());
        }
 
+       // Run post validation filter chain
+       runFilterChain('post_refid_validation');
+
        // Return determined refid
        return getReferralId();
 }
index a623e70181d6dac2f41c4fa413b7821fc6adb3a0..10c3d95e96d9e27956c9ef3d8ff14b596cedeec5 100644 (file)
@@ -157,6 +157,7 @@ function doCallXmlCallbackFunction () {
 
                                // Is it there?
                                if (!function_exists($callbackName)) {
+                                       // No, then please add it
                                        reportBug(__FUNCTION__, __LINE__, 'callback=' . $callback . ',function=' . $function . 'arguments()=' . count($GLOBALS['__XML_ARGUMENTS'][$callback]) . ' - execute call-back does not exist.');
                                } // END - if
 
index 30d0763955e2395b218f99cb45d1c29749dbb7c3..43ccce3f6d4de2619f30f824b9cd99b78787a82a 100644 (file)
@@ -16,7 +16,7 @@ CREATE TABLE `{?_MYSQL_PREFIX?}_admins` (
   `password` VARCHAR(255) NOT NULL DEFAULT '',
   `email` VARCHAR(255) NOT NULL,
   PRIMARY KEY  (`id`),
-  UNIQUE (`login`)
+  UNIQUE INDEX (`login`)
 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT 'Administrator accounts';
 
 DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_cats`;
diff --git a/templates/de/html/member/member_add_subid.tpl b/templates/de/html/member/member_add_subid.tpl
new file mode 100644 (file)
index 0000000..4f7ab9b
--- /dev/null
@@ -0,0 +1,27 @@
+<div align="center">
+<form accept-charset="UTF-8" action="{%url=modules.php?module=login&amp;what=subids%}" method="post">
+<div class="table dashed">
+       <div class="table_header bottom">
+               <strong>{--MEMBER_ADD_SUBID_TITLE--}</strong>
+       </div>
+
+       <fieldset id="subid">
+               <legend>{--MEMBER_ADD_SUBID_LEGEND--}</legend>
+
+               <div class="table_row">
+                       <label for="subid">{--MEMBER_ENTER_SUBID--}</label>
+                       <input type="text" class="form_field" id="subid" name="subid" size="30" />
+               </div>
+       </fieldset>
+
+       <div class="table_footer top" style="margin-top:5px" colspan="2" align="center">
+               <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
+               <input type="submit" name="add_subid" class="form_submit" value="{--MEMBER_ADD_SUBID_SUBMIT--}" />
+       </div>
+</div>
+</form>
+</div>
+
+<div class="notice">
+       {--MEMBER_ADD_SUBID_NOTICE--}
+</div>
diff --git a/templates/de/html/member/member_list_user_subids.tpl b/templates/de/html/member/member_list_user_subids.tpl
new file mode 100644 (file)
index 0000000..81e0b79
--- /dev/null
@@ -0,0 +1,24 @@
+<div align="center">
+<form accept-charset="UTF-8" action="{%url=modules.php?module=login&amp;what=subids%}" method="post">
+<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
+       <tr>
+               <td colspan="3" align="center" class="table_header bottom">
+                       <strong>{--MEMBER_USER_SUBID_EDIT_DELETE_TITLE--}</strong>
+               </td>
+       </tr>
+       <tr>
+               <td align="center" class="header_column bottom right" width="20"><strong>{--ID_SELECT--}</strong></td>
+               <td align="center" class="header_column bottom right" width="160"><strong>{--SUBID_VALUE--}:</strong></td>
+               <td align="center" class="header_column bottom" width="160"><strong>{--SUBID_ADDED--}:</strong></td>
+       </tr>
+       $content
+       <tr>
+               <td colspan="3" class="table_footer">
+                       <input type="reset" class="form_reset" value="{--UNDO_SELECTIONS--}" />
+                       <input type="submit" class="form_submit" name="edit" value="{--MEMBER_ACTION_EDIT_SUBMIT--}" />
+                       <input type="submit" class="form_delete" name="delete" value="{--MEMBER_ACTION_DELETE_SUBMIT--}" />
+               </td>
+       </tr>
+</table>
+</form>
+</div>
diff --git a/templates/de/html/member/member_list_user_subids_row.tpl b/templates/de/html/member/member_list_user_subids_row.tpl
new file mode 100644 (file)
index 0000000..9d8d0ee
--- /dev/null
@@ -0,0 +1,16 @@
+<tr>
+       <td class="{%template,ColorSwitch%} bottom right" align="center">
+               <input type="checkbox" title="{--ID_SELECT--} $content[id]" class="form_field" name="sel[$content[id]]" value="1" />
+       </td>
+       <td class="{%template,ColorSwitch%} bottom right">
+               <div class="tiny">
+                       $content[subid]
+               </div>
+               <div class="tiny">
+                       <a href="{%url=modules.php?module=login&amp;what=subids&amp;do=stats&amp;id=$content[id]%}">{--MEMBER_USER_SUBID_STATS_LINK--}</a>
+               </div>
+       </td>
+       <td class="{%template,ColorSwitch%} bottom" align="center">
+               $content[subid_added]
+       </td>
+</tr>
index 2a3cf23b354f32d6664f381b40fd3a8e8e486908..fc99eccbe0e5a6f7404f933c0f9866ccb72483fa 100644 (file)
@@ -1,4 +1,4 @@
-<div align="center">
+<div align="center">
 <form accept-charset="UTF-8" action="{%url=modules.php?module=login&amp;what=mydata%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
        <tr>
@@ -6,12 +6,14 @@
                        <strong>{--YOUR_LOGIN--}: {%pipe,getMemberId%}</strong>
                </td>
        </tr>
+
        <tr>
                <td align="right">{--GENDER--}:</td>
                <td>
                        {%pipe,generateGenderSelectionBox=$content[gender]%}
                </td>
        </tr>
+
        <tr>
                <td align="right">{--SURNAME--}, {--FAMILY--}:</td>
                <td>
                        <input type="text" class="form_field" name="family" size="15" maxlength="255" value="{%user,family%}" />
                </td>
        </tr>
+
        <tr>
                <td align="right">{--STREET_NR--}:</td>
                <td>
                        <input type="text" class="form_field" name="street_nr" size="25" maxlength="255" value="{%user,street_nr%}" />
                </td>
        </tr>
+
        <tr>
                <td align="right">{--COUNTRY--}, {--ZIP--}, {--CITY--}:</td>
                <td>
                        <input type="text" class="form_field" name="city" size="20" maxlength="255" value="{%user,city%}" />
                </td>
        </tr>
+
        <tr>
                <td align="right">{--EMAIL--}:</td>
                <td>
                        <input type="text" class="form_field" name="email" size="30" maxlength="255" value="$content[email]" />
                </td>
        </tr>
+
        <tr>
                <td class="bottom" align="right">{--BIRTHDAY--}:</td>
                <td class="bottom">$content[dob]</td>
        </tr>
+
        <tr>
-               <td class="bottom" align="center" colspan="2">$content[max_receive_list]</td>
+               <td class="bottom" align="center" colspan="2">
+                       $content[max_receive_list]
+               </td>
        </tr>
+
        <tr>
                <td class="bottom" colspan="2" align="center">
                        <span class="notice">{--MEMBER_MYDATA_NOTICE--}</span>
                </td>
        </tr>
+
        <tr>
                <td align="right">{--PASS_1--}:</td>
                <td>
                        <input type="password" class="form_field" name="pass1" size="10" maxlength="255" />
                </td>
        </tr>
+
        <tr>
                <td class="bottom" align="right">{--PASS_2--}:</td>
                <td class="bottom">
                        <input type="password" class="form_field" name="pass2" size="10" maxlength="255" />
                </td>
        </tr>
+
        <tr>
                <td colspan="2" class="table_footer" align="center">
                        <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
index b3423ce422a8b735ae5b097a15065924eeed5749..ec0c7b3c9bf4dbc7ea9bc0b081ed663e0d18965e 100644 (file)
@@ -63,4 +63,16 @@ MA  02110-1301  USA
                <callback-function-list-entry name="" type="string" value="bigintval" />
                <callback-function-list-entry name="" type="string" value="" />
        </callback-function-list>
+       <!--
+       Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
+       is provided, we have more than two parameters to handle over to the
+       call-back function. See function handleExtraValues() for details.
+       //-->
+       <extra-parameter-list>
+       </extra-parameter-list>
+       <!--
+       Columns for converting single time selections into a timestamp
+       //-->
+       <time-columns-list>
+       </time-columns-list>
 </admin-entry-meta-data>
index 29c6335f447506fa53629b6804e35eb36bf50b0a..137b84e7b8210e15f611bedf182d09fa8ccae8b2 100644 (file)
@@ -55,4 +55,16 @@ MA  02110-1301  USA
                <callback-function-list-entry name="" type="string" value="convertCommaToDot" />
                <callback-function-list-entry name="" type="string" value="" />
        </callback-function-list>
+       <!--
+       Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
+       is provided, we have more than two parameters to handle over to the
+       call-back function. See function handleExtraValues() for details.
+       //-->
+       <extra-parameter-list>
+       </extra-parameter-list>
+       <!--
+       Columns for converting single time selections into a timestamp
+       //-->
+       <time-columns-list>
+       </time-columns-list>
 </admin-entry-meta-data>
index 8f22414a5a0775e1d1719ddf696d5722db5681df..9539e61bec9fa94710d8289a4591b8ae91873136 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index 5695045ca2ddb6d7c1161ef7a2b8966c30272f29..294082a9e77fe265265641ad16d760ae06340ec6 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index fc557e2d9c9dfe03103e834adec8274242d67959..4d886e0ada7bb4747a90469a3e1e41fc7221101a 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index fa5afb10b4636d36e37002aa29a3166427816391..c5e77728201bc037fc700c68e6da72ddfc0afaae 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index 8c263407bbc6e74d6bb6ed3a00a995dddc042900..7d74b2cf86da3a2f552283dedd9f72e1a6774bb4 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index 7a5cfe18e118127c8b5288525077da620c2cfcaa..e1ae325dd93b165030d915a24705c1f68c4cb614 100644 (file)
@@ -28,9 +28,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index 9e5bd7615bfb7c679dba5e39d4623fe7589b7294..4cd3591be11376f09552c43db208f0eb1c91188f 100644 (file)
@@ -29,9 +29,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index e9f20a06404db9b3684c4d31a146d9ca1e339d04..de5491b0cae5614afb7c41dbd5a9433eb27c042f 100644 (file)
@@ -29,9 +29,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index b5834b10b9ce0c078d274f5da7c2ca7d2b5e83d5..7f106a507c0f082bf5456edfa66737574a0f471d 100644 (file)
@@ -29,9 +29,9 @@ MA  02110-1301  USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        Now we need information which template should be loaded and which functions
        shall be called back. So lets start with the main list template. This mostly
index 6decdeeade429f8fca028a2ebb54414145b1f3c1..4a5311dffc393f69b06ab6fcb960559288412fe5 100644 (file)
@@ -29,10 +29,10 @@ MA 02110-1301 USA
        <!--
        Call-back function, the extracted data from this XML will then be re-read
        from that function. The most common function this XML uses is
-       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
        Use adminListJoinEntries for JOINs:
        //-->
-       <callback-function type="string" value="adminListEntries" />
+       <callback-function type="string" value="doGenericListEntries" />
        <!--
        //-->
        <!--
diff --git a/templates/xml/member/.htaccess b/templates/xml/member/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/templates/xml/member/member_add_do_subid.xml b/templates/xml/member/member_add_do_subid.xml
new file mode 100644 (file)
index 0000000..5cbce31
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+This template provides meta data for adding sub ids to the database.
+
+@author                Roland Haeder <webmaster@mxchange.org>
+@version       0.2.1-FINAL
+@copyright     (c) 2003 - 2009 by Roland Haeder
+@copyright     (c) 2009 - 2012 by Mailer Developer Team
+@license       GNU GPL 2.0 or any newer version
+@link          http://mxchange.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA  02110-1301  USA
+//-->
+<member-entry-meta-data>
+       <!--
+       Call-back function which should all following parameter handled over
+       to. This will always be type of string but we like homogene XMLs.
+       //-->
+       <callback-function type="string" value="memberAddEntries" />
+       <!--
+       Name of the database table where the entries should be read/write from/to.
+       //-->
+       <database-table name="" type="string" value="user_subids" />
+       <!--
+       The following three lists must have the same count of list entries, else an
+       error may occur.
+       //-->
+       <!--
+       And all column names to read/write, leave this list tag empty for all (*).
+       //-->
+       <database-column-list>
+               <database-column-list-entry name="" type="string" table="" value="userid" alias="" function="" />
+               <database-column-list-entry name="" type="string" table="" value="subid" alias="" function="" />
+       </database-column-list>
+       <!--
+       "Filter" call-back functions to call back for piping the fetched data
+       through (can be left empty, no call-back function will be called)
+       //-->
+       <callback-function-list>
+               <callback-function-list-entry name="" type="string" value="bigintval" />
+               <callback-function-list-entry name="" type="string" value="prepareSubId" />
+       </callback-function-list>
+       <!--
+       Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
+       is provided, we have more than two parameters to handle over to the
+       call-back function. See function handleExtraValues() for details.
+       //-->
+       <extra-parameter-list>
+       </extra-parameter-list>
+       <!--
+       Columns for converting single time selections into a timestamp
+       //-->
+       <time-columns-list>
+       </time-columns-list>
+</member-entry-meta-data>
diff --git a/templates/xml/member/member_list_subid.xml b/templates/xml/member/member_list_subid.xml
new file mode 100644 (file)
index 0000000..717e7b0
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+This template provides meta data for listing member's sub ids
+
+@author                Roland Haeder <webmaster@mxchange.org>
+@version       0.2.1-FINAL
+@copyright     (c) 2003 - 2009 by Roland Haeder
+@copyright     (c) 2009 - 2012 by Mailer Developer Team
+@license       GNU GPL 2.0 or any newer version
+@link          http://mxchange.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA  02110-1301  USA
+//-->
+<member-list-data>
+       <!--
+       Call-back function, the extracted data from this XML will then be re-read
+       from that function. The most common function this XML uses is
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
+       //-->
+       <callback-function type="string" value="doGenericListEntries" />
+       <!--
+       Now we need information which template should be loaded and which functions
+       shall be called back. So lets start with the main list template. This mostly
+       requires no call-back function.
+       //-->
+       <list-template type="string" value="member_list_user_subids" />
+       <!--
+       The template for all rows, mostly this name has a '_row' suffix and again,
+       no call-back function is usually required.
+       //-->
+       <list-row-template type="string" value="member_list_user_subids_row" />
+       <!--
+       Message id to display if no entry could be found
+       //-->
+       <no-entry-found-message type="string" value="MEMBER_USER_SUBIDS_404" />
+       <!--
+       The table(s) we shall grab the data from, all as list.
+       //-->
+       <data-tables>
+               <!--
+               A single table entry, with alias and without the configurable
+               _MYSQL_PREFIX. You can specify the table's name or alias later on.
+               //-->
+               <data-table type="string" alias="" value="user_subids" />
+               <!--
+               Columns to perform the SELECT statement on, with alias and name plus which table.
+               //-->
+               <select-data-from-list>
+                       <!--
+                       A single entry with table name (can be left empty), value (must
+                       always be set), alias (again can be left empty) and SQL function
+                       (can also be left empty) which shall be applied on the column.
+                       //-->
+                       <select-data-from-list-entry type="string" table="" value="id" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="subid" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="subid_added" alias="subid_added" function="UNIX_TIMESTAMP" />
+               </select-data-from-list>
+               <!--
+               And the column list to perform the WHERE statement on.
+               //-->
+               <where-select-from-list>
+                       <!--
+                       Search for current user's sub ids
+                       //-->
+                       <where-select-from-list-entry type="string" table="" value="userid" condition="EQUALS" look-for="{%pipe,getMemberId%}" />
+               </where-select-from-list>
+               <!--
+               Columns to perform the ORDER BY statement (GROUP BY is not yet supported)
+               //-->
+               <order-by-list>
+                       <!--
+                       A single entry to perform the ORDER BY statement on, see above WHERE entry for details.
+                       //-->
+                       <order-by-list-entry type="string" table="" order="subid" value="ASC" />
+               </order-by-list>
+       </data-tables>
+       <!--
+       List all column names from the 'select-data-from-list' node here, but now
+       with call-back informations. The list must only contain those entries where
+       a call-back function shall be called for.
+       //-->
+       <column-callback-list>
+               <!--
+               Another column, now we need a second parameter here because
+               generateDateTime() expects two parameters (first is always the data
+               from column).
+               //-->
+               <column-callback-list-entry>
+                       <!--
+                       The actual data, again.
+                       //-->
+                       <column-callback-data type="string" value="subid_added" callback="generateDateTime" />
+                       <!--
+                       More parameters, remember that the first parameter is always given
+                       and that it is the data from column.
+                       //-->
+                       <callback-extra-parameter-list>
+                               <!--
+                               A single parameter, 'type' can be one of 'float', 'int',
+                               'bool', 'string'. 'array' is not yet supported.
+                               //-->
+                               <callback-extra-parameter-list-entry type="int" column="subid_added" value="2" />
+                       </callback-extra-parameter-list>
+               </column-callback-list-entry>
+       </column-callback-list>
+</member-list-data>