Deprecated action=login (admin area) removed
[mailer.git] / inc / extensions / ext-yoomedia.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  * Needs to be in all Files and every File needs "svn propset           *
19  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
20  * -------------------------------------------------------------------- *
21  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
24  * This program is free software; you can redistribute it and/or modify *
25  * it under the terms of the GNU General Public License as published by *
26  * the Free Software Foundation; either version 2 of the License, or    *
27  * (at your option) any later version.                                  *
28  *                                                                      *
29  * This program is distributed in the hope that it will be useful,      *
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
32  * GNU General Public License for more details.                         *
33  *                                                                      *
34  * You should have received a copy of the GNU General Public License    *
35  * along with this program; if not, write to the Free Software          *
36  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
42         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
43         require($INC);
44 }
45
46 // Version number
47 EXT_SET_VERSION('0.0');
48
49 // Version history array (add more with , '0.1.0' and so on)
50 EXT_SET_VER_HISTORY(array('0.0'));
51
52 // This extension is deprecated!
53 // Only since 'network' is ready! EXT_SET_DEPRECATED('Y');
54
55 switch ($EXT_LOAD_MODE)
56 {
57         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
58                 // SQL commands to run
59                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
60                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_sid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
61                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_passwd` VARCHAR(255) NOT NULL DEFAULT ''");
62                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_erotic_allowed` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0");
63                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_max_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(24 * 8)."");
64                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_wait` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60");
65                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_clicks_remain` INT(7) UNSIGNED NOT NULL DEFAULT 1000");
66                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_pay` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
67                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_total` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200");
68                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_remain` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200");
69
70                 // Admin menu
71                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_yoomedia','Yoo!Media Interface 2.0','Einstellungen zum Yoo!Media Interface 2.0, wie User-ID, Interface-Passwort und vieles mehr.',17)");
72                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_yoomedia_reload`");
76                 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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 `y_type` (`type`,`y_id`)
84 ) TYPE={!_TABLE_TYPE!} COMMENT='Reload lock reminder for Yoo!Media campaigns'");
85                 break;
86
87         case 'remove': // Do stuff when removing extension
88                 // SQL commands to run
89                 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm')");
90                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_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 ($EXT_VER)
103                 {
104                         case '0.0.1': // SQL queries for v0.0.1
105                                 ADD_EXT_SQL('');
106
107                                 // Update notes (these will be set as task text!)
108                                 EXT_SET_UPDATE_NOTES('');
109                                 break;
110                 }
111                 break;
112
113                         case 'modify': // When the extension got modified
114                                 break;
115
116                         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
117                                 break;
118
119                         default: // Do stuff when extension is loaded
120                                 // The translation table
121                                 $GLOBALS['translation_tables']['yoomedia'] = array(
122                                 // Error messages
123                 'error_codes' => array(
124                                 1  => 'wrong_pass',
125                                 2  => 'wrong_sid',
126                                 3  => 'website_locked',
127                                 4  => 'api_data_error',
128                                 5  => 'requests_depleted',
129                                 6  => 'zero_result',
130                                 10 => 'incomplete_request'
131                                 ),
132                                 // For text mails
133                 'textmail' => array(
134                                 0 => 'id',
135                                 1 => 'name',
136                                 2 => 'reload',
137                                 3 => 'wait',
138                                 4 => 'remain',
139                                 5 => 'pay',
140                                 6 => 'text'
141                                 )
142                                 );
143                                 break;
144 }
145
146 // Keep this extension always active!
147 EXT_SET_ALWAYS_ACTIVE('Y');
148
149 //
150 ?>