]> git.mxchange.org Git - mailer.git/blob - inc/extensions/ext-yoomedia.php
c2fb1850248a6645f9297e27a1f7ae5e68316c3c
[mailer.git] / inc / extensions / ext-yoomedia.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/27/2008 *
4  * ===================                          Last change: 08/27/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-yoomedia.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Extension for contacting the API of Yoo!Media    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Erweitertung zur Anbindung an die API von        *
12  *                     Yoo!Media                                        *
13  * -------------------------------------------------------------------- *
14  * $Revision::                                                        $ *
15  * $Date::                                                            $ *
16  * $Tag:: 0.2.1-FINAL                                                 $ *
17  * $Author::                                                          $ *
18  * -------------------------------------------------------------------- *
19  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
20  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
21  * For more information visit: http://mxchange.org                      *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 } // END - if
43
44 // Version number
45 setThisExtensionVersion('0.0.0');
46
47 // Version history array (add more with , '0.0.1' and so on)
48 setExtensionVersionHistory(array('0.0.0'));
49
50 // Keep this extension always active!
51 setExtensionAlwaysActive('Y');
52
53 // This extension is deprecated
54 // @TODO Only deprecated when 'ext-network' is ready: setExtensionDeprecated('Y');
55
56 switch (getExtensionMode()) {
57         case 'setup': // Do stuff when installation is running
58                 // SQL commands to run
59                 addConfigAddSql('yoomedia_id', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
60                 addConfigAddSql('yoomedia_sid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
61                 addConfigAddSql('yoomedia_passwd', "VARCHAR(255) NOT NULL DEFAULT ''");
62                 addConfigAddSql('yoomedia_erotic_allowed', 'TINYINT(2) UNSIGNED NOT NULL DEFAULT 0' ) ;
63                 addConfigAddSql('yoomedia_tm_max_reload', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT ' . (24 * 8));
64                 addConfigAddSql('yoomedia_tm_min_wait', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60');
65                 addConfigAddSql('yoomedia_tm_clicks_remain', 'INT(7) UNSIGNED NOT NULL DEFAULT 1000');
66                 addConfigAddSql('yoomedia_tm_min_pay', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
67                 addConfigAddSql('yoomedia_requests_total', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200');
68                 addConfigAddSql('yoomedia_requests_remain', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200');
69
70                 // Admin menu
71                 addAdminMenuSql('setup', 'config_yoomedia', 'Yoo!Media Interface 2.0','Einstellungen zum Yoo!Media Interface 2.0, wie Affiliate-Id, Interface-Passwort und vieles mehr.',17);
72                 addAdminMenuSql('email', 'list_yoomedia_tm', 'Yoo!Media Textmails','Listet Textmail-Buchungen &uuml;ber das Interface 2.0 von Yoo!Media nach Ihren eingestellten Kriterien auf. <strong>Vorsicht:</strong> Jede Aktualisierung dieser Liste kostet Ihnen eine Abfrage!',10);
73
74                 // Reload lock table
75                 addDropTableSql('yoomedia_reload');
76                 addCreateTableSql('yoomedia_reload', "
77 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
78 `type` VARCHAR(255) NOT NULL DEFAULT 'general',
79 `y_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
80 `y_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0,
81 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
82 PRIMARY KEY (`id`),
83 UNIQUE INDEX `y_type` (`type`, `y_id`)",
84                         'Reload lock reminder for Yoo!Media campaigns');
85                 break;
86
87         case 'remove': // Do stuff when removing extension
88                 // SQL commands to run
89                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm')");
90                 addDropTableSql('yoomedia_reload');
91                 break;
92
93         case 'activate': // Do stuff when admin activates this extension
94                 // SQL commands to run
95                 break;
96
97         case 'deactivate': // Do stuff when admin deactivates this extension
98                 // SQL commands to run
99                 break;
100
101         case 'update': // Update an extension
102                 switch (getCurrentExtensionVersion()) {
103                         case '0.0.1': // SQL queries for v0.0.1
104                                 addExtensionSql('');
105
106                                 // Update notes (these will be set as task text!)
107                                 setExtensionUpdateNotes('');
108                                 break;
109                 } // END - switch
110                 break;
111
112         case 'modify': // When the extension got modified
113                 break;
114
115         case 'test': // For testing purposes
116                 break;
117
118         case 'init': // Do stuff when extension is initialized
119                 // The translation table
120                 // @TODO Can this be moved into a database table?
121                 $GLOBALS['translation_tables']['yoomedia'] = array(
122                         // Error messages
123                         'error_codes' => array(
124                                 -999 => 'unknown_error',
125                                 1    => 'wrong_pass',
126                                 2    => 'wrong_sid',
127                                 3    => 'website_locked',
128                                 4    => 'api_data_error',
129                                 5    => 'requests_depleted',
130                                 6    => 'zero_result',
131                                 7    => 'no_campaigns_with_interface',
132                                 10   => 'incomplete_request'
133                         ),
134                         // For text mails
135                         'textmail' => array(
136                                 0 => 'id',
137                                 1 => 'name',
138                                 2 => 'reload',
139                                 3 => 'wait',
140                                 4 => 'remain',
141                                 5 => 'pay',
142                                 6 => 'text'
143                         )
144                 );
145                 break;
146
147         default: // Unknown extension mode
148                 reportBug(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
149                 break;
150 } // END - switch
151
152 // [EOF]
153 ?>