]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-yoomedia.php
Marked some unfinished extensions as 'work-in-progress'
[mailer.git] / inc / extensions / ext-yoomedia.php
index 48c9832afa85f5b8ff480a01bf47571ceab4f34b..8d1803bec1c61f19f5c4d83855b841b56280be2b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 08/27/2008 *
- * ================                             Last change: 08/27/2008 *
+ * Mailer v0.2.1-FINAL                                Start: 08/27/2008 *
+ * ===================                          Last change: 08/27/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-yoomedia.php                                 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-yoomedia.php                                 *
@@ -18,7 +18,8 @@
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
-       require($INC);
+       die();
 }
 
 // Version number
 }
 
 // Version number
-EXT_SET_VERSION('0.0');
+setThisExtensionVersion('0.0');
 
 // Version history array (add more with , '0.1.0' and so on)
 
 // Version history array (add more with , '0.1.0' and so on)
-EXT_SET_VER_HISTORY(array('0.0'));
+setExtensionVersionHistory(array('0.0'));
+
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
 
 // This extension is deprecated!
 
 // This extension is deprecated!
-// Only since 'network' is ready! EXT_SET_DEPRECATED('Y');
+// @TODO Only deprecated when 'network' is ready! setExtensionDeprecated('Y');
 
 
-switch ($EXT_LOAD_MODE)
-{
+switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_sid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_passwd` VARCHAR(255) NOT NULL DEFAULT ''");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_erotic_allowed` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_max_reload` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(24 * 8)."");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_wait` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_clicks_remain` INT(7) UNSIGNED NOT NULL DEFAULT 1000");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_tm_min_pay` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_total` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200");
-               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `yoomedia_requests_remain` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 200");
+               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
 
                // Admin menu
-               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)");
-               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)");
+               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 &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);
 
                // Reload lock table
 
                // Reload lock table
-               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_yoomedia_reload`");
-               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_yoomedia_reload` (
+               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,
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `type` VARCHAR(255) NOT NULL DEFAULT 'general',
 `y_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -81,13 +83,13 @@ switch ($EXT_LOAD_MODE)
 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`id`),
 UNIQUE `y_type` (`type`,`y_id`)
 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`id`),
 UNIQUE `y_type` (`type`,`y_id`)
-) TYPE={!_TABLE_TYPE!} COMMENT='Reload lock reminder for Yoo!Media campaigns'");
+) TYPE={?_TABLE_TYPE?} COMMENT='Reload lock reminder for Yoo!Media campaigns'");
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_yoomedia','list_yoomedia_tm')");
-               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_yoomedia_reload`");
+               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
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -99,38 +101,40 @@ UNIQUE `y_type` (`type`,`y_id`)
                break;
 
        case 'update': // Update an extension
                break;
 
        case 'update': // Update an extension
-               switch ($EXT_VER)
+               switch (getCurrentExtensionVersion())
                {
                        case '0.0.1': // SQL queries for v0.0.1
                {
                        case '0.0.1': // SQL queries for v0.0.1
-                               ADD_EXT_SQL('');
+                               addExtensionSql('');
 
                                // Update notes (these will be set as task text!)
 
                                // Update notes (these will be set as task text!)
-                               EXT_SET_UPDATE_NOTES('');
+                               setExtensionUpdateNotes('');
                                break;
                }
                break;
 
                                break;
                }
                break;
 
-                       case 'modify': // When the extension got modified
-                               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 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+               break;
 
 
-                       default: // Do stuff when extension is loaded
-                               // The translation table
-                               $GLOBALS['translation_tables']['yoomedia'] = array(
-                               // Error messages
-               'error_codes' => array(
+       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(
                                1  => 'wrong_pass',
                                2  => 'wrong_sid',
                                3  => 'website_locked',
                                4  => 'api_data_error',
                                5  => 'requests_depleted',
                                6  => 'zero_result',
                                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'
                                10 => 'incomplete_request'
-                               ),
-                               // For text mails
-               'textmail' => array(
+                       ),
+                       // For text mails
+                       'textmail' => array(
                                0 => 'id',
                                1 => 'name',
                                2 => 'reload',
                                0 => 'id',
                                1 => 'name',
                                2 => 'reload',
@@ -138,13 +142,14 @@ UNIQUE `y_type` (`type`,`y_id`)
                                4 => 'remain',
                                5 => 'pay',
                                6 => 'text'
                                4 => 'remain',
                                5 => 'pay',
                                6 => 'text'
-                               )
-                               );
-                               break;
-}
+                       )
+               );
+               break;
 
 
-// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE('Y');
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               break;
+}
 
 
-//
+// [EOF]
 ?>
 ?>