X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-yoomedia.php;h=bafb7d03cfa75f7cf222f0e071065c6b54bea6d5;hb=074767f2ad1cfd011221dec75eda51a6eb74ade9;hp=92c7cb5c20d6e3ec9215cf034549d8365e579c81;hpb=758d2a24de233b0742964428cd11114094917043;p=mailer.git diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 92c7cb5c20..bafb7d03cf 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -1,7 +1,7 @@ "; -debug_print_backtrace(); -print "
"; -*/ - -switch ($EXT_LOAD_MODE) -{ -case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) - // SQL commands to run - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_sid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_passwd` VARCHAR(255) NOT NULL DEFAULT ''"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_erotic_allowed` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_tm_max_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(24 * 8).""; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_tm_min_wait` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_tm_clicks_remain` INT(7) UNSIGNED NOT NULL DEFAULT 1000"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_tm_min_pay` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_requests_total` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `yoomedia_requests_remain` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200"; - - // Admin menu - $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)"; - $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. Vorsicht: Jede Aktualisierung dieser Liste kostet Ihnen eine Abfrage!',10)"; - - // Reload lock table - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_yoomedia_reload`"; - $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_yoomedia_reload` ( +setThisExtensionVersion('0.0'); + +// Version history array (add more with , '0.1.0' and so on) +setExtensionVersionHistory(array('0.0')); + +// Keep this extension always active! +setExtensionAlwaysActive('Y'); + +// This extension is deprecated! +// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y'); + +switch (getExtensionMode()) { + case 'register': // Do stuff when installation is running (modules.php?module=admin is called) + // SQL commands to run + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_sid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_passwd` VARCHAR(255) NOT NULL DEFAULT ''"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_erotic_allowed` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_tm_max_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(24 * 8).""); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_tm_min_wait` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_tm_clicks_remain` INT(7) UNSIGNED NOT NULL DEFAULT 1000"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_tm_min_pay` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_requests_total` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `yoomedia_requests_remain` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200"); + + // Admin menu + 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); + addAdminMenuSql('email','list_yoomedia_tm','Yoo!Media Textmails','Listet Textmail-Buchungen über das Interface 2.0 von Yoo!Media nach Ihren eingestellten Kriterien auf. Vorsicht: Jede Aktualisierung dieser Liste kostet Ihnen eine Abfrage!',10); + + // Reload lock table + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_yoomedia_reload`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_yoomedia_reload` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `type` VARCHAR(255) NOT NULL DEFAULT 'general', `y_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, @@ -82,64 +83,74 @@ case "register": // Do stuff when installation is running (modules.php?module=ad `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE `y_type` (`type`,`y_id`) -) TYPE=MyISAM COMMENT='Reload lock reminder for Yoo!Media campaigns'"; - break; - -case "remove": // Do stuff when removing extension - // SQL commands to run - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm') LIMIT 2"; - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_yoomedia_reload`"; - break; - -case "activate": // Do stuff when admin activates this extension - // SQL commands to run - break; - -case "deactivate": // Do stuff when admin deactivates this extension - // SQL commands to run - break; - -case "update": // Update an extension - switch ($EXT_VER) - { - case "0.0.1": // SQL queries for v0.0.1 - $SQLs[] = ""; - - // Update notes (these will be set as task text!) - $UPDATE_NOTES = ""; +) TYPE={?_TABLE_TYPE?} COMMENT='Reload lock reminder for Yoo!Media campaigns'"); break; - } - break; - -default: // Do stuff when extension is loaded - // The translation table - $yoomediaTranslationTable = array( - // Error messages - 'error_codes' => array( - 1 => 'wrong_pass', - 2 => 'wrong_sid', - 3 => 'website_locked', - 4 => 'api_data_error', - 5 => 'requests_depleted', - 6 => 'zero_result', - 10 => 'incomplete_request' - ), - // For text mails - 'textmail' => array( - 0 => 'id', - 1 => 'name', - 2 => 'reload', - 3 => 'wait', - 4 => 'remain', - 5 => 'pay', - 6 => 'text' - ) - ); - break; -} -// Keep this extension always active! -$EXT_ALWAYS_ACTIVE = "Y"; + case 'remove': // Do stuff when removing extension + // SQL commands to run + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm')"); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_yoomedia_reload`'); + break; + + case 'activate': // Do stuff when admin activates this extension + // SQL commands to run + break; + + case 'deactivate': // Do stuff when admin deactivates this extension + // SQL commands to run + break; + + case 'update': // Update an extension + switch (getCurrentExtensionVersion()) + { + case '0.0.1': // SQL queries for v0.0.1 + addExtensionSql(''); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes(''); + break; + } + break; + + case 'modify': // When the extension got modified + break; + + case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + + case 'init': // Do stuff when extension is initialized + // The translation table + // @TODO Can this be moved into a database table? + $GLOBALS['translation_tables']['yoomedia'] = array( + // Error messages + 'error_codes' => array( + -999 => 'unknown_error', + 1 => 'wrong_pass', + 2 => 'wrong_sid', + 3 => 'website_locked', + 4 => 'api_data_error', + 5 => 'requests_depleted', + 6 => 'zero_result', + 7 => 'no_campaigns_with_interface', + 10 => 'incomplete_request' + ), + // For text mails + 'textmail' => array( + 0 => 'id', + 1 => 'name', + 2 => 'reload', + 3 => 'wait', + 4 => 'remain', + 5 => 'pay', + 6 => 'text' + ) + ); + break; + + default: // Unknown extension mode + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName())); + break; +} -// +// [EOF] ?>