Extensions bitcoins/yacy added, new API functions for handling proxy/non-proxy added:
[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 and ref overview                         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ref-Back und Ref-Uebersicht                      *
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://www.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.1');
45
46 // Version history array (add more with , '0.1.0' and so on)
47 setExtensionVersionHistory(array('0.0','0.0.1'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
51                 // SQL commands to run
52                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_refs`');
53                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_refs` (
54 `id` BIGINT(20) UNSIGNED NOT NULL auto_increment,
55 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
56 `level` smallINT(6) UNSIGNED NOT NULL DEFAULT 0,
57 `refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
58 `refback` float(4,1) NOT NULL DEFAULT 0.0,
59 `points` FLOAT( 20,5) DEFAULT 0.00000 NOT NULL,
60 PRIMARY KEY (`id`),
61 UNIQUE `user_refid` (`userid`,`level`,`refid`),
62 KEY (`level`),
63 KEY (`refid`)
64 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'User Referals With Refback'");
65                 addMemberMenuSql('main','refback','Ref-Back einstellen','N','Y',4);
66
67                 // Execute this special file on registration
68                 addIncludeToPool('extension', 'inc/gen_refback.php');
69                 break;
70
71         case 'remove': // Do stuff when removing extension
72                 // SQL commands to run
73                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_refs`');
74                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='refback'");
75                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_refback','list_refback')");
76                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET level=level-1");
77                 break;
78
79         case 'activate': // Do stuff when admin activates this extension
80                 // SQL commands to run
81                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what` IN('refback','reflist') LIMIT 2");
82                 break;
83
84         case 'deactivate': // Do stuff when admin deactivates this extension
85                 // SQL commands to run
86                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what` IN('refback','reflist') LIMIT 2");
87                 break;
88
89         case 'update': // Update an extension
90                 switch (getCurrentExtensionVersion()) {
91                         case '0.0.1': // SQL queries for v0.0.1
92                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `refback_enabled` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
93                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `refback_min_perc` TINYINT(3) NOT NULL DEFAULT 0");
94                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `refback_max_perc` TINYINT(3) NOT NULL DEFAULT 100");
95                                 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);
96                                 addAdminMenuSql('user','list_refback','Refback auflisten','Refback aller Mitglieder auflisten.',15);
97
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Refback-System ist nun ein-/ausschaltbar und minimale/maximale Refback-Prozente sind festlegbar.");
100                                 break;
101                 } // END - switch
102                 break;
103
104         case 'modify': // When the extension got modified
105                 break;
106
107         case 'test': // For testing purposes
108                 break;
109
110         case 'init': // Do stuff when extension is initialized
111                 break;
112
113         default: // Unknown extension mode
114                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
115                 break;
116 } // END - switch
117
118 // [EOF]
119 ?>