X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-order.php;h=8a125bf515f60b4231b6fead745bd1618e6fdf8e;hb=3f7f0051c91c54cb691303b9d49fb9cd1a7a4e8c;hp=68b87ef4dc1ca5bcbfe30d9d4a76c4d05188851d;hpb=1c62a6c2a4ed2bb170e0f1888899625e67a27947;p=mailer.git diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index 68b87ef4dc..8a125bf515 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -41,21 +41,26 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.5.2'); +setThisExtensionVersion('0.5.3'); -// Version history array (add more with , '0.1.0' and so on) -setExtensionVersionHistory(array('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')); +// Version history array (add more with , '0.0.1' and so on) +setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3')); switch (getExtensionMode()) { - case 'register': // Do stuff when installation is running (modules.php?module=admin is called) + case 'register': // Do stuff when installation is running // SQL commands to run - addExtensionSql(''); + addMemberMenuSql('order', 'order', 'Mailbuchung', 1); break; case 'remove': // Do stuff when removing extension // SQL commands to run + addDropTableSql('url_blacklist'); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'"); + + // Remove these filters + unregisterFilter(__FUNCTION__, __LINE__, 'get_total_points', 'ORDER_POINTS', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'get_own_points', 'ORDER_POINTS', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension @@ -73,7 +78,7 @@ switch (getExtensionMode()) { case 'update': // Update an extension switch (getCurrentExtensionVersion()) { case '0.1.0': // SQL queries for v0.1 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `order_max_full` ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'"); + addConfigAddSql('order_max_full', "ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'"); addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7); // Update notes (these will be set as task text!) @@ -81,8 +86,6 @@ switch (getExtensionMode()) { break; case '0.1.1': // SQL queries for v0.1.1 - // OLD QUERIES: addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1"); - // OLD QUERIES: addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); // Update notes (these will be set as task text!) @@ -140,10 +143,10 @@ switch (getExtensionMode()) { break; case '0.2.3': // SQL queries for v0.2.3 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10"); + addConfigAddSql('order_min', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 10'); // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Minimum an Empfänger pro Mailbuchung einstellbar. Standart: 10 Empfänger"); + setExtensionUpdateNotes("Minimum an Empfänger pro Mailbuchung einstellbar. Standard: 10 Empfänger"); break; case '0.2.4': // SQL queries for v0.2.4 @@ -192,8 +195,8 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us break; case '0.3.1': // SQL queries for v0.3.1 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'"); + addConfigAddSql('order_select', "VARCHAR(255) NOT NULL DEFAULT 'userid'"); + addConfigAddSql('order_mode', "ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Beworbene URL wird nun getestet."); @@ -270,8 +273,8 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us break; case '0.4.6': // SQL queries for v0.4.6 - addMemberMenuSql('order',NULL,'Mailbuchungen','N','Y',3); - addMemberMenuSql('order','order2','Framekiller-Mails','N','Y',2); + addMemberMenuSql('order', NULL, 'Mailbuchungen', 3); + addMemberMenuSql('order', 'order2', 'Framekiller-Mails', 2); addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`=1, `title`='Klick-Mails' WHERE `what`='order' LIMIT 1"); // Update notes (these will be set as task text!) @@ -291,55 +294,68 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us break; case '0.4.9': // SQL queries for v0.4.9 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'"); + addConfigAddSql('repay_deleted_mails', "ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Bei Löschung von Mailbuchungen kann nun scripteweit entschieden werden (Einstellungen also), ob die verbliebenen {?POINTS?} wieder gutgeschrieben werden sollen oder in den Jackpot landen."); break; case '0.5.0': // SQL queries for v0.5.0 - addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_url_blacklist`'); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_url_blacklist` ( + addDropTableSql('url_blacklist'); + addCreateTableSql('url_blacklist', " `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `url` VARCHAR(255) NOT NULL DEFAULT '', `pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), -INDEX (`pool_id`) -) TYPE={?_TABLE_TYPE?} COMMENT='URL blacklist'"); +INDEX (`pool_id`)", + 'URL blacklist'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Tabelle für URL-Sperrliste angelegt."); break; case '0.5.1': // SQL queries for v0.5.1 - addMemberMenuSql('main','order','Mailbuchung','N','Y',8); - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Weiteren Menü-Query in Erweiterung verlagert."); + setExtensionUpdateNotes("Nicht mehr gültiges Update."); break; case '0.5.2': // SQL queries for v0.5.2 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_text`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_subj`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_text` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_subject` ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigDropSql('test_text'); + addConfigDropSql('test_subj'); + addConfigAddSql('allow_url_in_text', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigAddSql('allow_url_in_subject', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert."); break; + + case '0.5.3': // SQL queries for v0.5.3 + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `locked_order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + + // This update depends on ext-user + addExtensionDependency('user'); + + // Register filters for gathering points + registerFilter(__FUNCTION__, __LINE__, 'get_total_points', 'ORDER_POINTS', true, isExtensionDryRun()); + registerFilter(__FUNCTION__, __LINE__, 'get_own_points', 'ORDER_POINTS', true, isExtensionDryRun()); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Weiteres {?POINTS?}-Guthabenkonto "Werbeguthaben" hinzugefügt (verschoben von ext-user) und neue Filter zum Zurückliefern des Werbeguthabens hinzugefügt."); + break; } // END - switch break; case 'modify': // When the extension got modified break; - case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + case 'test': // For testing purposes break; case 'init': // Do stuff when extension is initialized // Do daily reset only when installed and extension version is at least 0.1.1 - // @TODO This should be moved out to inc/reset/ + // @TODO This should be moved out to inc/daily/ if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) { // Reset mail order values $result_ext = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__);