2 /************************************************************************
3 * MXChange v0.2.1 Start: 08/27/2008 *
4 * ================ Last change: 08/27/2008 *
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 *
13 * -------------------------------------------------------------------- *
15 * -------------------------------------------------------------------- *
16 * Copyright (c) 2003 - 2008 by Roland Haeder *
17 * For more information visit: http://www.mxchange.org *
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
24 * This program is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU General Public License for more details. *
29 * You should have received a copy of the GNU General Public License *
30 * along with this program; if not, write to the Free Software *
31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
33 ************************************************************************/
35 // Some security stuff...
36 if (!defined('__SECURITY')) {
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
47 // Version history array (add more with , "0.1" and so on)
48 $EXT_VER_HISTORY = array("0.0");
50 // This extension is deprecated!
51 $EXT_DEPRECATED = "Y";
53 switch ($EXT_LOAD_MODE)
55 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
56 // SQL commands to run
57 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
58 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_sid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
59 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_passwd` VARCHAR(255) NOT NULL DEFAULT ''";
60 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_erotic_allowed` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0";
61 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_max_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(24 * 8)."";
62 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_wait` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60";
63 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_clicks_remain` INT(7) UNSIGNED NOT NULL DEFAULT 1000";
64 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_pay` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
65 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_total` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200";
66 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_remain` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200";
69 $SQLs[] = "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)";
70 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','list_yoomedia_tm','Yoo!Media Textmails','Listet Textmail-Buchungen ü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 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_yoomedia_reload`";
74 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_yoomedia_reload` (
75 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
76 `type` VARCHAR(255) NOT NULL DEFAULT 'general',
77 `y_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
78 `y_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0,
79 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
81 UNIQUE `y_type` (`type`,`y_id`)
82 ) TYPE=MyISAM COMMENT='Reload lock reminder for Yoo!Media campaigns'";
85 case "remove": // Do stuff when removing extension
86 // SQL commands to run
87 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm') LIMIT 2";
88 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_yoomedia_reload`";
91 case "activate": // Do stuff when admin activates this extension
92 // SQL commands to run
95 case "deactivate": // Do stuff when admin deactivates this extension
96 // SQL commands to run
99 case "update": // Update an extension
102 case "0.0.1": // SQL queries for v0.0.1
105 // Update notes (these will be set as task text!)
111 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
114 default: // Do stuff when extension is loaded
115 // The translation table
116 $yoomediaTranslationTable = array(
118 'error_codes' => array(
121 3 => 'website_locked',
122 4 => 'api_data_error',
123 5 => 'requests_depleted',
125 10 => 'incomplete_request'
141 // Keep this extension always active!
142 $EXT_ALWAYS_ACTIVE = "Y";