From: Roland Häder Date: Sun, 31 Jul 2011 12:16:48 +0000 (+0000) Subject: Earning subscriptions introduced (unfinished): X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=a636d6415605b148ba0989f51442145cd8361ee4 Earning subscriptions introduced (unfinished): - Generic support (unfinished admin/member scripts) added for extra earnings on a "subscription" basis. The user can (or shall when finished) see how much he/she earned per "earning subscription". This whole data table is now cached, other user_earning will follow - Extension ext-forced continued, reload lock and minimum stay moved to campaigns - Fix in inc/db/lib-mysql3.php for badly named variable (now: $isAlterIndex) which could cause many ALTER TABLE commands to fail - Other minor improvements --- diff --git a/.gitattributes b/.gitattributes index 0aca48a71b..6a16f1a654 100644 --- a/.gitattributes +++ b/.gitattributes @@ -372,6 +372,7 @@ inc/loader/.htaccess svneol=native#text/plain inc/loader/load- svneol=native#text/plain inc/loader/load-admins.php svneol=native#text/plain inc/loader/load-config.php svneol=native#text/plain +inc/loader/load-earning.php svneol=native#text/plain inc/loader/load-extension.php svneol=native#text/plain inc/loader/load-extensions.php svneol=native#text/plain inc/loader/load-filter.php svneol=native#text/plain @@ -645,6 +646,7 @@ inc/modules/member/what-booking.php svneol=native#text/plain inc/modules/member/what-cash_coupon.php svneol=native#text/plain inc/modules/member/what-categories.php svneol=native#text/plain inc/modules/member/what-doubler.php svneol=native#text/plain +inc/modules/member/what-earnings.php svneol=native#text/plain inc/modules/member/what-guest.php svneol=native#text/plain inc/modules/member/what-holiday.php svneol=native#text/plain inc/modules/member/what-html_mail.php svneol=native#text/plain diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 473159e03d..a86d391cd9 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -363,16 +363,16 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) { $result = false; // Determine index/fulltext/unique word - $noIndex = ( - ( - isInStringIgnoreCase('INDEX', $sql) - ) && ( - isInStringIgnoreCase('KEY', $sql) - ) && ( - isInStringIgnoreCase('FULLTEXT', $sql) - ) && ( - isInStringIgnoreCase('UNIQUE', $sql) - ) + $isAlterIndex = ( + ( + isInString('INDEX', $sql) + ) && ( + isInString('KEY', $sql) + ) && ( + isInString('FULLTEXT', $sql) + ) && ( + isInString('UNIQUE', $sql) + ) ); // Extract table name @@ -380,10 +380,10 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) { $tableName = str_replace('`', '', $tableArray[2]); // Debug log - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=
' . print_r($tableArray, true) . '
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=
' . print_r($tableArray, true) . '
,isAlterIndex=' . intval($isAlterIndex)); // Shall we add/drop? - if (((isInString('ADD', $sql)) || (isInString('DROP', $sql)) || (isInString('CHANGE', $sql))) && ($noIndex === true)) { + if (((isInString('ADD', $sql)) || (isInString('DROP', $sql)) || (isInString('CHANGE', $sql))) && ($isAlterIndex === false)) { // Try two columns, one should fix foreach (array(4,5) as $idx) { // If an entry is not set, abort here @@ -423,7 +423,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) { } elseif ((getTableType() == 'InnoDB') && (isInString('FULLTEXT', $sql))) { // Skip this query silently because InnoDB does not understand fulltext indexes //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : isSqlTableColumnFound($columnName)), $F, $L)); - } elseif ($noIndex === false) { + } elseif ($isAlterIndex === true) { // And column name as well without backticks $keyName = str_replace('`', '', $tableArray[5]); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyName=' . $keyName . ',tableArray=
' . print_r($tableArray, true) . '
'); diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 56e8c9fdbe..3cd5d7d627 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -52,7 +52,7 @@ switch (getExtensionMode()) { // - Menu systems addAdminMenuSql('setup', 'config_beg', 'Bettel-Link', 'IP-Sperre, {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Vergütung usw. können Sie hier einstellen.', 10); addGuestMenuSql('members', 'beg', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG} erbetteln!', 4); - addMemberMenuSql('main', 'beg', 'Ihr Bettel-Link', 6); + addMemberMenuSql('extras', 'beg', 'Ihr Bettel-Link', 1); // - Configuration addConfigAddSql('beg_timeout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 600'); addConfigAddSql('beg_userid_timeout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 1800'); diff --git a/inc/extensions/ext-forced.php b/inc/extensions/ext-forced.php index eb0346768c..2cbc078bcd 100644 --- a/inc/extensions/ext-forced.php +++ b/inc/extensions/ext-forced.php @@ -51,6 +51,9 @@ enableExtensionProductive(false); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running + // Add dependency for ext-sql_patches + addExtensionDependency('sql_patches'); + // All required tables for this extension: // - Ads addDropTableSql('forced_ads'); @@ -65,8 +68,6 @@ switch (getExtensionMode()) { `forced_ads_type` VARCHAR(255) NOT NULL DEFAULT 'INVALID', `forced_ads_views_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `forced_ads_clicks_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -`forced_ads_reload_lock` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -`forced_ads_min_stay` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `forced_ads_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`forced_ads_id`)", 'Forced Ads Data'); @@ -81,35 +82,16 @@ PRIMARY KEY (`forced_ads_id`)", `forced_campaign_lock_timetstamp` TIMESTAMP NULL DEFAULT NULL, `forced_campaign_expired` TIMESTAMP NULL DEFAULT NULL, `forced_campaign_ordered_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -`forced_campaign_costs_api` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL, -`forced_campaign_price_api` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL, +`forced_campaign_payment_api` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL, +`forced_campaign_reload_lock` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`forced_campaign_min_stay` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`forced_ads_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`forced_campaign_userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `forced_costs_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, PRIMARY KEY (`forced_campaign_id`), INDEX (`forced_costs_id`)", 'Forced Campaign Data'); - // - Campaigns <-> Ads - addDropTableSql('forced_campaigns_ads'); - addCreateTableSql('forced_campaigns_ads', " -`forced_campaign_ads_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, -`forced_campaign_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -`forced_ads_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -PRIMARY KEY (`forced_campaign_ads_id`), -UNIQUE `ads_campaign`(`forced_campaign_id`,`forced_ads_id`)", - 'Forced Campaigns<->Ads'); - - // - Campaigns <-> "User" (could be a member, sponsor, admin or "API") - addDropTableSql('forced_campaigns_user'); - addCreateTableSql('forced_campaigns_user', " -`forced_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, -`forced_campaign_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -`forced_user_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -`forced_user_type` ENUM('MEMBER','SPONSOR','ADMIN','API') NOT NULL DEFAULT 'ADMIN', -PRIMARY KEY (`forced_id`), -UNIQUE `forced_campaign_user` (`forced_campaign_id`,`forced_user_id`,`forced_user_type`), -INDEX (`forced_user_id`)", - 'Forced Campaigns<->User'); - // - Campaign costs addDropTableSql('forced_costs'); addCreateTableSql('forced_costs', " @@ -125,7 +107,7 @@ PRIMARY KEY (`forced_costs_id`)", addCreateTableSql('forced_stats', " `forced_stats_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `forced_stats_campaign_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -`forced_stats_user_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, +`forced_stats_userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `forced_stats_viewed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `forced_stats_clicked` TIMESTAMP NULL DEFAULT NULL, `forced_stats_real_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', @@ -135,22 +117,24 @@ PRIMARY KEY (`forced_costs_id`)", `forced_stats_session_id` VARCHAR(100) NULL DEFAULT NULL, PRIMARY KEY (`forced_stats_id`), INDEX (`forced_stats_campaign_id`), -INDEX (`forced_stats_user_id`)", +INDEX (`forced_stats_userid`)", 'Forced Campaign Statistics'); // Menu system // - Administrator - addAdminMenuSql('forced', NULL, 'Forced-Ads', 'Verwalten Sie hier bequem alle laufenden Forced-Banner und -Textlinks und deren Kampgnen. Sie können hier auch neue Werbmittel (Ads) hinzufügen oder laufende Forced-Kampagnen bei z.B. Regelverstössen sperren oder löschen. Auch das naträgliche Editieren von Ads und Kampagnen ist jederzeit möglich. Kampagnen dienen der einfacheren Verwaltung und der Trennung von dem Werbemittel selbst dienen. Sie brauchen also z.B. einen Forced-Banner nur einmal einfügen und können dann bei Bedarf weitere Kampagnen starten.', 5); + addAdminMenuSql('forced', NULL, 'Forced-Ads', 'Verwalten Sie hier bequem alle laufenden Forced-Banner, -Textlinks, -PopUps und deren Kampgnen. Sie können hier auch neue Werbmittel (Ads) hinzufügen oder laufende Forced-Kampagnen bei z.B. Regelverstössen sperren oder löschen. Auch das naträgliche Editieren von Ads und Kampagnen ist jederzeit möglich. Kampagnen dienen der einfacheren Verwaltung und der Trennung von dem Werbemittel selbst dienen. Sie brauchen also z.B. einen Forced-Banner nur einmal einfügen und können dann bei Bedarf weitere Kampagnen starten.', 5); addAdminMenuSql('forced', 'list_forced_ads', 'Werbemittel verwalten', 'Listet alle eingetragenen Werbmittel (Ads) auf und fügt neue hinzu. Sie können hier diese nachträglich editieren falls Sie mal eine falsche URL eingegeben haben oder den Text ändern wollen. Löschen Sie hier auch Forced-Banner, die nicht mehr gültig sind (z.B. abgelaufen sind). Sollten doch mit dem Werbmittel verknüpfte Kampagnen vorhanden sein, erhalten Sie einen Warnhinweis. Neue Werbmittel können Sie hier ebenfalls hinzufügen. Denken Sie aber daran, dass ohne Kampagne dieses nicht angezeigt wird. Achten Sie hier auch die Reload-Sperre.', 2); addAdminMenuSql('forced', 'list_forced_campaigns', 'Kampagnen verwalten', 'Listet alle Kampagnen auf und zeigt deren Status an. Jederzeit können Sie Kampagnen stoppen, falls Sie dies wünschen oder ein Regelverstoss vorliegt. Haben Sie ein Werbemittel hinzugefügt, so fügen Sie bitte unbedingt eine Kampagne hinzu, da es sonst nicht angezeigt wird.', 3); addAdminMenuSql('forced', 'list_forced_costs', 'Kosten verwalten', 'Legen Sie die Preise pro Klick zum Buchen Forced-Werbemittel fest und wie viele {OPEN_CONFIG}POINTS{CLOSE_CONFIG} Ihre Mitglieder erhalten sollen. Generell sollten Sie bei Mitgliederbuchungen höhere Kosten pro Klick als was Ihre Mitglieder pro Klick erhalten einstellen, da so die {OPEN_CONFIG}POINTS{CLOSE_CONFIG} abgebaut werden (Sie können an Accountaufladungen z.B. verdienen).', 4); addAdminMenuSql('forced', 'stats_forced', 'Statistiken', 'Zeigt Gesamtstatistiken und zu den einzelnen Kampagnen und Werbmitteln an. Die hier angezeigte Statistik kann jedoch nicht manuell gelöscht werden (bitte auch nicht selber tun) da sie auch gleichzeitigt als Reload-Sperre dient.', 5); // - Members - addMemberMenuSql('earn', 'forced_banner', 'Forced-Banner', 2); - addMemberMenuSql('earn', 'forced_textlink', 'Forced-Textlinks', 3); - addMemberMenuSql('extras','book_forced_banner','Forced-Banner buchen', 3); - addMemberMenuSql('extras','book_forced_textlink','Forced-Textlink buchen', 4); + addMemberMenuSql('earn', 'forced_banner', 'Forced-Banner', 3); + addMemberMenuSql('earn', 'forced_textlink', 'Forced-Textlinks', 4); + addMemberMenuSql('extras', 'book_forced', 'Forced-Kampagne buchen', 3); + + // Register Forced-PopUps with earning_data table + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_earning_data` (`earning_group`,`earning_name`,`earning_sorting`) VALUES ('POPUP','FORCED_POPUP',1)"); // Register filter for default forced ad types registerFilter('add_forced_ads_types', 'FORCED_AD_TYPE_DEFAULTS', false, true, isExtensionDryRun()); @@ -160,14 +144,15 @@ INDEX (`forced_stats_user_id`)", // SQL commands to run addDropTableSql('forced_ads'); addDropTableSql('forced_campaigns'); - addDropTableSql('forced_campaigns_ads'); - addDropTableSql('forced_campaigns_user'); addDropTableSql('forced_costs'); addDropTableSql('forced_stats'); // Menu systems - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='forced' LIMIT 5"); - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('forced_banner','forced_textlink') LIMIT 2"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='forced'"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('forced_banner','forced_textlink','book_forced') LIMIT 3"); + + // Unregister Forced-PopUps from earning_data + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_earning_data` WHERE `earning_name`='FORCED_POPUP' LIMIT 1"); // Remove filter unregisterFilter(__FUNCTION__, __LINE__, 'add_forced_ads_types', 'FORCED_AD_TYPE_DEFAULTS', true, isExtensionDryRun()); diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index 2f8d6fa860..cccb291a9b 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -51,7 +51,9 @@ switch (getExtensionMode()) { // SQL commands to run addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nickname` VARCHAR(255) NOT NULL DEFAULT ''"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nick_userid` ENUM ('nick','userid') NOT NULL DEFAULT 'userid'"); - addMemberMenuSql('main','nickname','Nicknamen',5); + + // Add member menu + addMemberMenuSql('extras', 'nickname', 'Nicknamen', 2); break; case 'remove': // Do stuff when removing extension @@ -99,7 +101,7 @@ switch (getExtensionMode()) { addConfigAddSql('nickname_len', 'TINYINT(3) UNSIGNED NOT NULL DEFAULT 5'); addConfigAddSql('nickname_pattern', "VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'"); addConfigAddSql('nickname_chars', "VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'"); - addAdminMenuSql('setup','config_nickname','Nicknamen','Stellen Sie minimale Nicknamenlänge, sowie erlaubte Zeichen hier ein.', 12); + addAdminMenuSql('setup', 'config_nickname', 'Nicknamen', 'Stellen Sie minimale Nicknamenlänge, sowie erlaubte Zeichen hier ein.', 12); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Minimale Länge, sowie erlaubte Zeichen sind per Adminbereich änderbar. Setzen Sie als erlaubte Zeichen nur URL-konforme Zeichen ein!"); @@ -170,7 +172,7 @@ switch (getExtensionMode()) { break; case '0.1.9': // SQL queries for v0.1.9 - addAdminMenuSql('user','list_nickname','Nickname-Historie','Listet alle verwendeten Nicknames der Mitglieder auf.', 12); + addAdminMenuSql('user', 'list_nickname', 'Nickname-Historie', 'Listet alle verwendeten Nicknames der Mitglieder auf.', 12); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Menuüpunkt für Nickname-History hinzugefügt."); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index e869cf0904..089d578a35 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -41,17 +41,17 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.8.4'); +setThisExtensionVersion('0.8.5'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4')); +setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5')); // Keep this extension always active! setExtensionAlwaysActive('Y'); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running - // This depends on 'cache' now + // This depends on ext-cache now addExtensionDependency('cache'); break; @@ -77,7 +77,8 @@ IN ( 'config_proxy', 'config_session', 'list_filter', - 'list_point_accounts' + 'list_point_accounts', + 'list_earnings' )"); // Delete/update member menu entries @@ -113,8 +114,7 @@ IN ( case 'update': // Update an extension switch (getCurrentExtensionVersion()) { case '0.0.1': // SQL queries for v0.0.1 - addConfigAddSql('ext_autopurge', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); - addAdminMenuSql('setup','config_extensions','Erweitungsmanagement','Alle Einstellungen am Erweiterungsmanagement.', 10); + addAdminMenuSql('setup', 'config_extensions', 'Erweitungsmanagement', 'Alle Einstellungen am Erweiterungsmanagement.', 10); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Es kann nun bestimmt werden, ob vom Server gelöschte ext-xxx.php erkannt werden sollen und die verknüpften Daten auch aus der Datenbank entfernt werden sollen."); @@ -783,7 +783,7 @@ INDEX (`ip`)", case '0.7.7': // SQL queries for v0.7.7 addMemberMenuSql('earn', NULL, 'Verdienen', 2); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='earn', `sort`=1 WHERE `what`='unconfirmed' LIMIT 1"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='earn',`sort`=1 WHERE `what`='unconfirmed' LIMIT 1"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Menüpunkt Verdienen hinzugefügt und Unbestätigte Mails als ersten Punkt dort hin verschoben."); @@ -810,12 +810,12 @@ INDEX (`ip`)", `locked_mode` ENUM('LOCKED','UNLOCKED') NOT NULL DEFAULT 'LOCKED', `payment_method` ENUM('DIRECT','REFERAL') NOT NULL DEFAULT 'REFERAL', `notify_recipient` ENUM('Y','N') NOT NULL DEFAULT 'N', -PRIMARY KEY(`id`), +PRIMARY KEY (`id`), INDEX (`subject`)", 'Points account data'); // Admin menu - addAdminMenuSql('setup','list_point_accounts','Guthabenkonten...','Veralten Sie hier bequem Einstellungen zu den Guthabenkonten.',5); + addAdminMenuSql('setup', 'list_point_accounts', 'Guthabenkonten...', 'Veralten Sie hier bequem Einstellungen zu den Guthabenkonten.', 5); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Tabelle points_data erzeugt, diese soll das {?POINTS?}-Guthaben komplett lenken."); @@ -851,7 +851,6 @@ INDEX (`subject`)", break; case '0.8.4': // SQL queries for v0.8.4 - addDropTableSql('history'); addCreateTableSql('history', " `history_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `history_subject` VARCHAR(255) NOT NULL DEFAULT 'GENERIC', @@ -870,6 +869,47 @@ INDEX (`history_last_used` DESC)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Allgemeine Historie-Tabelle hinzugefügt."); break; + + case '0.8.5': // SQL queries for v0.8.5 + // Old-lost configuration entry + addConfigDropSql('ext_autopurge'); + + // Extra earning for our members :-) + addMemberMenuSql('earn', 'earnings', 'Zusatzverdienste', 2); + + // Admin menu + addAdminMenuSql('setup', 'list_earnings', 'Zusatzverdienste...', 'Veralten Sie hier bequem alle Zusatzverdienste (wie z.B. vergütete PopUps usw.).', 6); + + // Earning data table + addDropTableSql('earning_data'); + addCreateTableSql('earning_data', " +`earning_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`earning_group` VARCHAR(255) NOT NULL DEFAULT 'INVALID', +`earning_name` VARCHAR(255) NOT NULL DEFAULT 'INVALID', +`earning_sorting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +PRIMARY KEY (`earning_id`), +UNIQUE `earning_group_name` (`earning_group`,`earning_name`)", + 'Registered (extra) earnings'); + + // User->earnings connection table + addDropTableSql('user_earning'); + addCreateTableSql('user_earning', " +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`earning_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`earning_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`earning_active` ENUM('Y','N') NOT NULL DEFAULT 'Y', +`earning_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +`earning_canceled` TIMESTAMP NULL DEFAULT NULL, +`earning_daily_amount` SMALLINT(7) NOT NULL DEFAULT 0, +`earning_points` FLOAT(20,5) NOT NULL DEFAULT 0.00000, +PRIMARY KEY (`id`), +UNIQUE `user_earning` (`earning_id`,`earning_userid`), +INDEX (`earning_userid`)", + 'User->Earning connections'); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Menüpunkt für Zusatzverdienste wie z.B. Forced-PopUps hinzugefügt und uralten Konfigurationseintrag entfernt."); + break; } // END - switch break; @@ -880,6 +920,12 @@ INDEX (`history_last_used` DESC)", break; case 'init': // Do stuff when extension is initialized + // Transfer POINTS word + if (isExtensionInstalledAndNewer('sql_patches', '0.0.3')) { + // Okay, recent enough, so transfer the word for POINTS + setConfigEntry('POINTS', getPointsWord()); + } // END - if + // Init key setConfigEntry('secret_key', ''); @@ -904,11 +950,6 @@ INDEX (`history_last_used` DESC)", debug_report_bug(__FILE__, __LINE__, 'Cannot read secret file! Please try to reload.'); } } // END - if - - // Transfer words/numbers to constants if config entry is found - if (isExtensionInstalledAndNewer('sql_patches', '0.0.3')) { - setConfigEntry('POINTS', getPointsWord()); - } // END - if break; default: // Unknown extension mode diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index b395c513bf..ef3c813913 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -85,7 +85,7 @@ INDEX (`to_userid`)", addAdminMenuSql('transfer','del_transfer','Manuell löschen','Hier können Sie - abgesehen von der automatischen Löschung - Transaktionen selber löschen. Bitte beachten Sie, dass immer aus- und eingehende Transaktionen gleichzeitig gelöscht werden.', 3); // Member menu - addMemberMenuSql('main', 'transfer', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer', 5); + addMemberMenuSql('extras', 'transfer', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer', 5); // Add config values addConfigAddSql('transfer_max', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 50'); diff --git a/inc/filter/cache_filter.php b/inc/filter/cache_filter.php index c2facdbf99..be8b48cdd2 100644 --- a/inc/filter/cache_filter.php +++ b/inc/filter/cache_filter.php @@ -49,7 +49,7 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($filterData) { } // END - if // Remove cache - foreach (array('config','extension','filter','modules') as $cache) { + foreach (array('config', 'extension', 'filter', 'modules', 'earning') as $cache) { if ($GLOBALS['cache_instance']->loadCacheFile($cache)) { $GLOBALS['cache_instance']->removeCacheFile(); } // END - if @@ -87,7 +87,7 @@ function FILTER_CACHE_DESTROY_ALL ($filterData) { } // END - if // Remove cache files - foreach (array('admin','admin_acls','config','extension','modules','refdepths','refsystem','themes','filter','imprint') as $cache) { + foreach (array('admin', 'admin_acls', 'config', 'extension', 'earning', 'modules', 'refdepths', 'refsystem', 'themes', 'filter', 'imprint') as $cache) { // Is the cache file readable? // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal. if ($GLOBALS['cache_instance']->loadCacheFile($cache)) { diff --git a/inc/filters.php b/inc/filters.php index 2737ceca3b..03943c8517 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -1145,7 +1145,7 @@ function FILTER_HANDLE_HOME_IN_INDEX_SETTING ($filterData) { // Filter to add history entry function FILTER_ADD_HISTORY_ENTRY ($filterData) { // Add the entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_history` (`history_subject`,`history_userid`,`history_value`) VALUES('%s',%s,'%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_history` (`history_subject`,`history_userid`,`history_value`) VALUES ('%s',%s,'%s')", $filterData, __FUNCTION__, __LINE__); diff --git a/inc/language/forced_de.php b/inc/language/forced_de.php index c6f2579eb3..f2f4d13f25 100644 --- a/inc/language/forced_de.php +++ b/inc/language/forced_de.php @@ -66,8 +66,6 @@ addMessages(array( 'ADMIN_FORCED_ADS_CLICKS_COUNTER' => "Anzahl Forced-Klicks", 'ADMIN_FORCED_ADS_HAS_FRAMEBREAKER' => "Framekiller?", 'ADMIN_FORCED_ADS_ADDED' => "Hinzugefügt", - 'ADMIN_FORCED_ADS_RELOAD_LOCK' => "Reloadzeit", - 'ADMIN_FORCED_ADS_MINIMUM_STAY' => "Mindestauffenthalt", )); // [EOF] diff --git a/inc/libs/forced_functions.php b/inc/libs/forced_functions.php index 331f17e9cc..84f57641e9 100644 --- a/inc/libs/forced_functions.php +++ b/inc/libs/forced_functions.php @@ -75,89 +75,5 @@ function translateForcedAdType ($status) { return $return; } -// Handles the XML node 'extra-parameter-forced-ads-reload-lock-list' -function doXmlExtraParameterForcedAdsReloadLockList ($resource, $attributes) { - // There should be no attributes - if (count($attributes) > 0) { - // Please don't add any attributes to foo-list nodes - debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['forced_ads_reload_lock_list'])) { - // This list should be created already - debug_report_bug(__FUNCTION__, __LINE__, 'forced_ads_reload_lock_list should be already created.'); - } -} - -// Handles the XML node 'extra-parameter-forced-ads-reload-lock-list-entry' -function doXmlExtraParameterForcedAdsReloadLockListEntry ($resource, $attributes) { - // There are three attributes, by default - if (count($attributes) != 3) { - // Not the right count - debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); - } elseif (!isset($attributes['NAME'])) { - // 'NAME' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.'); - } elseif (!isset($attributes['TYPE'])) { - // 'TYPE' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); - } elseif (!isInvalidXmlType($attributes['TYPE'])) { - // No valid type - debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); - } elseif (!isset($attributes['VALUE'])) { - // 'VALUE' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); - } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { - // Not valid/verifyable - debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['forced_ads_reload_lock_list'])) { - // doXmlCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/forced-ads-reload-lock-list not included around this node. Please fix your XML.'); - } - - // Add the entry to the list - addXmlValueToCallbackAttributes('extra_list', $attributes, 'forced_ads_reload_lock_list'); -} - -// Handles the XML node 'extra-parameter-forced-ads-min-stay-list' -function doXmlExtraParameterForcedAdsMinStayList ($resource, $attributes) { - // There should be no attributes - if (count($attributes) > 0) { - // Please don't add any attributes to foo-list nodes - debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['forced_ads_min_stay_list'])) { - // This list should be created already - debug_report_bug(__FUNCTION__, __LINE__, 'forced_ads_min_stay_list should be already created.'); - } -} - -// Handles the XML node 'extra-parameter-forced-ads-min-stay-list-entry' -function doXmlExtraParameterForcedAdsMinStayListEntry ($resource, $attributes) { - // There are three attributes, by default - if (count($attributes) != 3) { - // Not the right count - debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); - } elseif (!isset($attributes['NAME'])) { - // 'NAME' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.'); - } elseif (!isset($attributes['TYPE'])) { - // 'TYPE' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); - } elseif (!isInvalidXmlType($attributes['TYPE'])) { - // No valid type - debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); - } elseif (!isset($attributes['VALUE'])) { - // 'VALUE' not found - debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); - } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { - // Not valid/verifyable - debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['forced_ads_min_stay_list'])) { - // doXmlCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/forced-ads-min-stay-list not included around this node. Please fix your XML.'); - } - - // Add the entry to the list - addXmlValueToCallbackAttributes('extra_list', $attributes, 'forced_ads_min_stay_list'); -} - // [EOF] ?> diff --git a/inc/loader/load- b/inc/loader/load- index e3c73b03af..da52c77498 100644 --- a/inc/loader/load- +++ b/inc/loader/load- @@ -4,7 +4,7 @@ * =================== Last change: 10/24/2009 * * * * -------------------------------------------------------------------- * - * File : load_cache- * + * File : load- * * -------------------------------------------------------------------- * * Short description : Load more cache files * * -------------------------------------------------------------------- * @@ -47,7 +47,7 @@ if (!defined('__SECURITY')) { if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_instance']->extensionVersionMatches('foo'))) { // Load cache $GLOBALS['cache_array']['foo'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (isHtmlMode()) { +} elseif (isHtmlOutputMode()) { // Create cache file $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load-earning.php b/inc/loader/load-earning.php new file mode 100644 index 0000000000..74ae2c1a4f --- /dev/null +++ b/inc/loader/load-earning.php @@ -0,0 +1,70 @@ +loadCacheFile('earning')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { + // Load cache + $GLOBALS['cache_array']['earning'] = $GLOBALS['cache_instance']->getArrayFromCache(); +} elseif ((isHtmlOutputMode()) && (isExtensionInstalledAndNewer('sql_patches', '0.8.5'))) { + // Create cache file + $GLOBALS['cache_instance']->init(); + + // Query the database about this + $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_earning_data` ORDER BY `earning_id` ASC', __FILE__, __LINE__); + while ($dummy = SQL_FETCHARRAY($result)) { + // Save row + $GLOBALS['cache_instance']->addRow($dummy); + } // END - while + + // Free memory + SQL_FREERESULT($result); + + // Close cache + $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); + $GLOBALS['cache_instance']->finalize(); +} + +// [EOF] +?> diff --git a/inc/module-functions.php b/inc/module-functions.php index cc75df10fb..e4ef7dff42 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -334,7 +334,7 @@ VALUES } // Debug log - logDebugMessage(__FUNCTION__, __LINE__, sprintf("module=%s, status=%s", $module_chk, getModuleStatus($module_chk))); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("module=%s, status=%s", $module_chk, getModuleStatus($module_chk))); // Return the value return getModuleStatus($module_chk); diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 886fd1d07d..850cc853eb 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -1246,7 +1246,7 @@ function adminAddEntries ($tableName, $columns = array(), $filterFunctions = arr } // END - foreach // Build the SQL query - $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName[0] . '` (`' . implode('`, `', $sqlColumns) . "`) VALUES('" . implode("','", $sqlValues) . "')"; + $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName[0] . '` (`' . implode('`, `', $sqlColumns) . "`) VALUES ('" . implode("','", $sqlValues) . "')"; // Run the SQL query SQL_QUERY($SQL, __FUNCTION__, __LINE__); diff --git a/inc/modules/admin/what-list_forced_ads.php b/inc/modules/admin/what-list_forced_ads.php index e9330c1437..0045c24957 100644 --- a/inc/modules/admin/what-list_forced_ads.php +++ b/inc/modules/admin/what-list_forced_ads.php @@ -88,14 +88,8 @@ if ($show === false) { // List all URLs showEntriesByXmlCallback('admin_list_forced_ads'); -// Prepare content for template -$content = array( - 'reload_lock' => createTimeSelections(0, 'forced_ads_reload_lock', 'WDhm'), - 'min_stay' => createTImeSelections(0, 'forced_ads_min_stay' , 'ms') -); - // Display form for adding a forced-ad -loadTemplate('admin_add_forced_ad', false, $content); +loadTemplate('admin_add_forced_ad'); // [EOF] ?> diff --git a/inc/modules/member/what-earnings.php b/inc/modules/member/what-earnings.php new file mode 100644 index 0000000000..4e651427a6 --- /dev/null +++ b/inc/modules/member/what-earnings.php @@ -0,0 +1,49 @@ + diff --git a/templates/de/html/admin/admin_add_forced_ad.tpl b/templates/de/html/admin/admin_add_forced_ad.tpl index 66049a3253..ee2718f30f 100644 --- a/templates/de/html/admin/admin_add_forced_ad.tpl +++ b/templates/de/html/admin/admin_add_forced_ad.tpl @@ -34,24 +34,6 @@ - - - {--ADMIN_ENTER_FORCED_AD_RELOAD_LOCK--} - - - $content[reload_lock] - - - - - - {--ADMIN_ENTER_FORCED_AD_MINIMUM_STAY--} - - - $content[min_stay] - - - {--ADMIN_SELECT_FORCED_AD_TYPE--} diff --git a/templates/de/html/admin/admin_list_forced_ads.tpl b/templates/de/html/admin/admin_list_forced_ads.tpl index 5dd973b5b7..dd0a5bada4 100644 --- a/templates/de/html/admin/admin_list_forced_ads.tpl +++ b/templates/de/html/admin/admin_list_forced_ads.tpl @@ -2,7 +2,7 @@
- @@ -11,13 +11,11 @@ - - - + $content - - - diff --git a/templates/xml/admin/admin_add_do_forced_ads.xml b/templates/xml/admin/admin_add_do_forced_ads.xml index 4b989c7653..92a1e908b9 100644 --- a/templates/xml/admin/admin_add_do_forced_ads.xml +++ b/templates/xml/admin/admin_add_do_forced_ads.xml @@ -45,8 +45,6 @@ MA 02110-1301 USA - - @@ -60,61 +58,9 @@ MA 02110-1301 USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/templates/xml/admin/admin_list_forced_ads.xml b/templates/xml/admin/admin_list_forced_ads.xml index bb9d676af9..98d4fa40cb 100644 --- a/templates/xml/admin/admin_list_forced_ads.xml +++ b/templates/xml/admin/admin_list_forced_ads.xml @@ -70,8 +70,6 @@ MA 02110-1301 USA - -
+ {--ADMIN_LIST_FORCED_ADS_TITLE--}
{--ADMIN_TEST_URL--} {--ADMIN_FORCED_ADS_TYPE--} {--ADMIN_FORCED_ADS_HAS_FRAMEBREAKER--}{--ADMIN_FORCED_ADS_ADDED--}{--ADMIN_FORCED_ADS_RELOAD_LOCK--}{--ADMIN_FORCED_ADS_MINIMUM_STAY--}{--ADMIN_FORCED_ADS_ADDED--}
{%pipe,translateYesNo=$content[forced_ads_framebreaker]%} - $content[forced_ads_added] - - {%pipe,createFancyTime=$content[forced_ads_reload_lock]%} - - {%pipe,createFancyTime=$content[forced_ads_min_stay]%} + $content[forced_ads_added]