2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/29/2008 *
4 * =================== Last change: 09/29/2008 *
6 * -------------------------------------------------------------------- *
7 * File : ext-refback.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Refback system *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Refback-System *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2015 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.0.4');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0','0.0.1', '0.0.2', '0.0.3', '0.0.4'));
49 switch (getExtensionMode()) {
50 case 'setup': // Do stuff when installation is running
52 addMemberMenuSql('main', 'refback', 'Refback einstellen', 4);
53 addMemberMenuSql('main', 'reflist', 'Ref-Übersicht', 5);
55 // Execute this special file on registration
56 addIncludeToPool('extension', 'inc/fix_refsystem.php');
59 case 'remove': // Do stuff when removing extension
60 // SQL commands to run
61 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='refback'");
62 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_refback','list_refback')");
64 // Unregister points data
65 unregisterExtensionPointsData('refback');
68 case 'activate': // Do stuff when admin activates this extension
69 // SQL commands to run
70 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what` IN('refback','reflist') LIMIT 2");
73 case 'deactivate': // Do stuff when admin deactivates this extension
74 // SQL commands to run
75 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what` IN('refback','reflist') LIMIT 2");
78 case 'update': // Update an extension
79 switch (getCurrentExtensionVersion()) {
80 case '0.0.1': // SQL queries for v0.0.1
81 addConfigAddSql('refback_enabled', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
82 addConfigAddSql('refback_min_perc', 'TINYINT(3) NOT NULL DEFAULT 0');
83 addConfigAddSql('refback_max_perc', 'TINYINT(3) NOT NULL DEFAULT 100');
84 addAdminMenuSql('setup', 'config_refback', 'Refback', 'Ändern Sie Einstellungen zum Refback, wie z.B. Minimum- und Maximum-Prozente, was die Mitglieder einstellen dürfen.', 15);
85 addAdminMenuSql('user', 'list_refback', 'Refback auflisten', 'Refback aller Mitglieder auflisten.', 15);
87 // Update notes (these will be set as task text!)
88 setExtensionUpdateNotes("Refback-System ist nun ein-/ausschaltbar und minimale/maximale Refback-Prozente sind festlegbar.");
91 case '0.0.2': // SQL queries for v0.0.2
92 // Update notes (these will be set as task text!)
93 setExtensionUpdateNotes("Ungültiges Update seit Revision 246x.");
96 case '0.0.3': // SQL queries for v0.0.3
97 // Register points data
98 registerExtensionPointsData('refback', 'points', 'LOCKED', 'DIRECT');
101 setExtensionUpdateNotes("Refback-Gutschriften werden nun über die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
104 case '0.0.4': // SQL queries for v0.0.4
105 // This extension update depends on ext-sql_patches
106 addExtensionDependency('user');
108 // SQL commands to run - drop old first, add new next
109 addExtensionDropTableColumnSql('user_refs', 'refback');
110 addExtensionDropTableColumnSql('user_refs', 'points');
111 addExtensionAddTableColumnSql('user_refs', 'refback_percents', 'FLOAT(4,1) NOT NULL DEFAULT 0.0');
112 addExtensionAddTableColumnSql('user_refs', 'refback_points', 'FLOAT(20,5) NOT NULL DEFAULT 0.00000');
115 setExtensionUpdateNotes("Refback-Gutschriften werden nun über die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
120 case 'modify': // When the extension got modified
123 case 'test': // For testing purposes
126 case 'init': // Do stuff when extension is initialized
129 default: // Unknown extension mode
130 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));