aca491b1bbc00a3cfd210378bc0f7ae92a10239e
[mailer.git] / inc / extensions / ext-refback.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 09/29/2008 *
4  * ===================                          Last change: 09/29/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-refback.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Refback system                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Refback-System                                   *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version number
44 setThisExtensionVersion('0.0.4');
45
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'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running
51                 // Member menu
52                 addMemberMenuSql('main', 'refback', 'Refback einstellen', 4);
53
54                 // Execute this special file on registration
55                 addIncludeToPool('extension', 'inc/fix_refsystem.php');
56                 break;
57
58         case 'remove': // Do stuff when removing extension
59                 // SQL commands to run
60                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='refback'");
61                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_refback','list_refback')");
62                 break;
63
64         case 'activate': // Do stuff when admin activates this extension
65                 // SQL commands to run
66                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what` IN('refback','reflist') LIMIT 2");
67                 break;
68
69         case 'deactivate': // Do stuff when admin deactivates this extension
70                 // SQL commands to run
71                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what` IN('refback','reflist') LIMIT 2");
72                 break;
73
74         case 'update': // Update an extension
75                 switch (getCurrentExtensionVersion()) {
76                         case '0.0.1': // SQL queries for v0.0.1
77                                 addConfigAddSql('refback_enabled', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
78                                 addConfigAddSql('refback_min_perc', 'TINYINT(3) NOT NULL DEFAULT 0');
79                                 addConfigAddSql('refback_max_perc', 'TINYINT(3) NOT NULL DEFAULT 100');
80                                 addAdminMenuSql('setup', 'config_refback', 'Refback', '&Auml;ndern Sie Einstellungen zum Refback, wie z.B. Minimum- und Maximum-Prozente, was die Mitglieder einstellen d&uuml;rfen.', 15);
81                                 addAdminMenuSql('user', 'list_refback', 'Refback auflisten', 'Refback aller Mitglieder auflisten.', 15);
82
83                                 // Update notes (these will be set as task text!)
84                                 setExtensionUpdateNotes("Refback-System ist nun ein-/ausschaltbar und minimale/maximale Refback-Prozente sind festlegbar.");
85                                 break;
86
87                         case '0.0.2': // SQL queries for v0.0.2
88                                 // Update notes (these will be set as task text!)
89                                 setExtensionUpdateNotes("Ung&uuml;tiges Update seit Revision 246x.");
90                                 break;
91
92                         case '0.0.3': // SQL queries for v0.0.3
93                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('refback','points','LOCKED','DIRECT')");
94
95                                 // This depends on ext-sql_patches
96                                 addExtensionDependency('sql_patches');
97
98                                 // Update notes
99                                 setExtensionUpdateNotes("Refback-Gutschriften werden nun &uuml;ber die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
100                                 break;
101
102                         case '0.0.4': // SQL queries for v0.0.4
103                                 // This extension update depends on ext-sql_patches
104                                 addExtensionDependency('user');
105
106                                 // SQL commands to run - drop old first, add new next
107                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` DROP `refback`');
108                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` DROP `points`');
109                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` ADD `refback_percents` FLOAT(4,1) NOT NULL DEFAULT 0.0');
110                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` ADD `refback_points` FLOAT(20,5) NOT NULL DEFAULT 0.00000');
111
112                                 // Update notes
113                                 setExtensionUpdateNotes("Refback-Gutschriften werden nun &uuml;ber die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
114                                 break;
115                 } // END - switch
116                 break;
117
118         case 'modify': // When the extension got modified
119                 break;
120
121         case 'test': // For testing purposes
122                 break;
123
124         case 'init': // Do stuff when extension is initialized
125                 break;
126
127         default: // Unknown extension mode
128                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
129                 break;
130 } // END - switch
131
132 // [EOF]
133 ?>