]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-forced.php
Added update_year.sh (still not fully flexible) and updated all years with it.
[mailer.git] / inc / extensions / ext-forced.php
index 58b505eb281cfd8985771a10c0a5f1cccdb0213a..39543015b32ab8281aac10bec497e8a3923472c8 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -41,24 +41,43 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.0');
+setThisExtensionVersion('0.0.0');
 
-// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0'));
 
 // This extension is in development (non-productive)
-enableExtensionProductive(false);
+enableExtensionProductive(FALSE);
 
 switch (getExtensionMode()) {
-       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
-               // This depends on 'sponsor' now
-               addExtensionDependency('sponsor');
-
-               // SQL commands to run
+       case 'setup': // Do stuff when installation is running
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
+               addDropTableSql('forced_ads');
+               addDropTableSql('forced_network');
+               addDropTableSql('forced_campaigns');
+               addDropTableSql('forced_costs');
+               addDropTableSql('forced_stats');
+
+               // Menu systems
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='forced'");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` LIKE '%forced%'");
+
+               // Is ext-earning there?
+               if (isExtensionInstalled('earning')) {
+                       // Unregister Forced-PopUps from ext-earning
+                       addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_earning_data` WHERE `earning_provider`='FORCED_POPUP' LIMIT 1");
+               } // END - if
+
+               // Remove filter
+               unregisterFilter(__FILE__, __LINE__, 'add_forced_ads_types', 'FORCED_AD_TYPE_DEFAULTS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'member_earning_table_data', 'FORCED_POPUP_TABLE_DATA', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_change_forced_campaign_status', 'FORCED_CHANGE_CAMPAIGN_STATUS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'pre_change_forced_campaign_status', 'FORCED_CHANGE_CAMPAIGN_VALIDATE_DATA', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'handle_click_php', 'HANDLE_FORCED_AD_CLICK', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'handle_view_php', 'HANDLE_FORCED_AD_VIEW', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -83,14 +102,14 @@ switch (getExtensionMode()) {
        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.
+       case 'test': // For testing purposes
                break;
 
        case 'init': // Do stuff when extension is initialized
                break;
 
        default: // Unknown extension mode
-               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
                break;
 } // END - switch