9a10ce006f59901d21f01342b0f5234c2d2d518c
[mailer.git] / inc / extensions / ext-payout.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/11/2004 *
4  * ===================                          Last change: 11/15/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-payout.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Payout extension                                 *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Auszahlung-Erweiterung                           *
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 - 2015 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 of this extension
44 setThisExtensionVersion('0.3.8');
45
46 // Version history array (add more with , '0.0.1' and so on)
47 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'));
48
49 switch (getExtensionMode()) {
50         case 'setup': // Do stuff when installation is running
51                 // SQL commands to run
52                 addDropTableSql('user_payouts');
53                 addCreateTableSql('user_payouts', "
54 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
56 `payout_total` FLOAT(22,3) UNSIGNED NOT NULL DEFAULT 0.000,
57 `target_account` VARCHAR(255) NOT NULL DEFAULT '',
58 `target_bank` VARCHAR(255) NOT NULL DEFAULT '',
59 `payout_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
60 `payout_timestamp` VARCHAR(10) NOT NULL DEFAULT 0,
61 `status` ENUM('NEW','ACCEPTED','REJECTED') NOT NULL DEFAULT 'NEW',
62 PRIMARY KEY (`id`),
63 INDEX (`userid`),
64 INDEX (`payout_id`)",
65                         'Done user payouts (and status)');
66
67                 addDropTableSql('payout_types');
68                 addCreateTableSql('payout_types', "
69 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
70 `type` VARCHAR(255) NOT NULL DEFAULT '',
71 `rate` FLOAT(22,3) UNSIGNED NOT NULL DEFAULT 0.000,
72 `min_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
73 PRIMARY KEY (`id`)",
74                         'Payout types');
75
76                 // Admin menu
77                 addAdminMenuSql('setup','config_payouts','Auszahlungen','Auszahlungsarten einstellen, neu anlegen oder l&ouml;schen.',15);
78                 addAdminMenuSql('payouts','list_payouts','Anfragen auflisten','Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.',16);
79
80                 // Member menu
81                 addMemberMenuSql('main', 'payout', 'Auszahlungen', 11);
82                 break;
83
84         case 'remove': // Do stuff when removing extension
85                 // SQL commands to run
86                 addDropTableSql('user_payouts');
87                 addDropTableSql('payout_types');
88                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='payouts'");
89                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='payout'");
90                 break;
91
92         case 'activate': // Do stuff when admin activates this extension
93                 // SQL commands to run
94                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='payout' LIMIT 1");
95                 break;
96
97         case 'deactivate': // Do stuff when admin deactivates this extension
98                 // SQL commands to run
99                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='payout' LIMIT 1");
100                 break;
101
102         case 'update': // Update an extension
103                 break;
104
105         case 'modify': // When the extension got modified
106                 break;
107
108         case 'test': // For testing purposes
109                 break;
110
111         case 'init': // Do stuff when extension is initialized
112                 break;
113
114         default: // Unknown extension mode
115                 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
116                 break;
117 } // END - switch
118
119 // [EOF]
120 ?>