d8e8dc61b9546a3ea03249024b2acd2cafed13d6
[mailer.git] / inc / extensions / ext-sponsor.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 03/22/2004 *
4  * ===================                          Last change: 06/28/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-sponsor.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Sponsor area                                     *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Sponsorenbereich                                 *
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 - 2013 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.0');
45
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0'));
48
49 // This extension is in development (non-productive)
50 enableExtensionProductive(FALSE);
51
52 switch (getExtensionMode()) {
53         case 'setup': // Do stuff when installation is running
54                 // This has been moved to inc/extensions/sponsor/mode-update.php
55                 break;
56
57         case 'remove': // Do stuff when removing extension
58                 // SQL commands to run
59                 addDropTableSql('sponsor_data');
60                 addDropTableSql('sponsor_orders');
61                 addDropTableSql('sponsor_action_convert');
62                 addDropTableSql('sponsor_paytypes');
63                 addDropTableSql('sponsor_menu');
64                 addDropTableSql('sponsor_registry');
65                 addDropTableSql('sponsor_urls');
66                 addDropTableSql('sponsor_banner');
67                 addDropTableSql('sponsor_campaigns');
68                 addDropTableSql('sponsor_campaign_assigns');
69                 addDropTableSql('sponsor_admin_data');
70                 addDropTableSql('sponsor_display_data');
71                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='sponsor' OR `what` IN('repr_sponsor','sponsor_medit','sponsor_madd')");
72                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='sponsor'");
73                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN('sponsor_list','sponsor_reg')");
74                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module` IN ('sponsor','sponsor_confirm','sponsor_ref') LIMIT 3");
75                 break;
76
77         case 'activate': // Do stuff when admin activates this extension
78                 // SQL commands to run
79                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `action`='sponsor'");
80                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='sponsor' LIMIT 1");
81                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_sponsor_menu` SET `active`='Y' WHERE active='N'");
82                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_sponsor_registry` SET `is_active`='Y' WHERE `is_active`='N'");
83                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N',`admin_only`='N',`mem_only`='N' WHERE `module` IN ('sponsor','sponsor_confirm','sponsor_ref') LIMIT 3");
84                 break;
85
86         case 'deactivate': // Do stuff when admin deactivates this extension
87                 // SQL commands to run
88                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `action`='sponsor'");
89                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='sponsor' LIMIT 1");
90                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_sponsor_menu` SET `active`='N' WHERE `active`='Y'");
91                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_sponsor_registry` SET `is_active`='N' WHERE `is_active`='Y'");
92                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module` IN ('sponsor','sponsor_confirm','sponsor_ref') LIMIT 3");
93                 break;
94
95         case 'update': // Update an extension
96                 switch (getCurrentExtensionVersion()) {
97                         case '0.0.1': // SQL queries for v0.0.1
98                                 addExtensionSql('');
99
100                                 // Update notes (these will be set as task text!)
101                                 setExtensionUpdateNotes('');
102                                 break;
103                 } // END - switch
104                 break;
105
106         case 'modify': // When the extension got modified
107                 break;
108
109         case 'test': // For testing purposes
110                 break;
111
112         case 'init': // Do stuff when extension is initialized
113                 break;
114
115         default: // Unknown extension mode
116                 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
117                 break;
118 } // END - switch
119
120 // [EOF]
121 ?>