]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-mediadata.php
Updated copyright notice as there are changes in this year
[mailer.git] / inc / extensions / ext-mediadata.php
index 1d70a5997b352096b0c2bf8fe2e6a46db615b826..1a2b99b5b3f467dab39c13ea6e9c4aa6bb14a9cf 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2013 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 *
@@ -44,41 +43,41 @@ if (!defined('__SECURITY')) {
 // Version number
 setThisExtensionVersion('0.0.9');
 
-// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
 
 switch (getExtensionMode()) {
-       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+       case 'setup': // Do stuff when installation is running
                // SQL commands to run
                addExtensionSql('');
 
                // Add the filters
-               registerFilter('add_points', 'UPDATE_MEDIADATA_ENTRY', false, true, getExtensionDryRun());
-               registerFilter('sub_points', 'UPDATE_MEDIADATA_ENTRY', false, true, getExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'post_add_points', 'UPDATE_MEDIADATA_ENTRY', FALSE, TRUE, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'post_sub_points', 'UPDATE_MEDIADATA_ENTRY', FALSE, TRUE, isExtensionDryRun());
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_mediadata`");
+               addDropTableSql('mediadata');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_mediadata'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='mediadata'");
 
                // Remove the filters
-               unregisterFilter('add_points', 'UPDATE_MEDIADATA_ENTRY', false, true, getExtensionDryRun());
-               unregisterFilter('sub_points', 'UPDATE_MEDIADATA_ENTRY', false, true, getExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_add_points', 'UPDATE_MEDIADATA_ENTRY', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_sub_points', 'UPDATE_MEDIADATA_ENTRY', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                // SQL commands to run
-               addExtensionSql('');
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `what`='mediadata' LIMIT 1");
                break;
 
        case 'deactivate': // Do stuff when admin deactivates this extension
                // SQL commands to run
-               addExtensionSql('');
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `what`='mediadata' LIMIT 1");
                break;
 
        case 'update': // Update an extension
@@ -100,12 +99,12 @@ switch (getExtensionMode()) {
 
                        case '0.0.4': // SQL queries for v0.0.4
                                // SQL commands to run
-                               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_mediadata`");
-                               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_mediadata` (
+                               addDropTableSql('mediadata');
+                               addCreateTableSql('mediadata', "
 `media_key` VARCHAR(255) NOT NULL DEFAULT '',
 `media_value` VARCHAR(255) NOT NULL DEFAULT '',
-PRIMARY KEY (media_key)
-) TYPE={?_TABLE_TYPE?}");
+PRIMARY KEY (`media_key`)",
+                                       'Media data key->value');
 
                                // Add auto-check file
                                addIncludeToPool('extension', 'inc/gen_mediadata.php');
@@ -125,9 +124,9 @@ PRIMARY KEY (media_key)
                                break;
 
                        case '0.0.7': // SQL queries for v0.0.7
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `mt_start` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `mt_stage` BIGINT(20) UNSIGNED NOT NULL DEFAULT '500'");
-                               addAdminMenuSql('setup','config_mediadata','Mediendaten','Stellen Sie allgemeine Einstellungen zu den Mediendaten ein.', 10);
+                               addConfigAddSql('mt_start', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+                               addConfigAddSql('mt_stage', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 500');
+                               addAdminMenuSql('setup', 'config_mediadata', 'Mediendaten', 'Stellen Sie allgemeine Einstellungen zu den Mediendaten ein.', 10);
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Start des {?mt_word2?} und Anzahl Anmeldungen aufgenommen. (Task #13)<br />
@@ -140,7 +139,7 @@ Bitte stellen Sie diesen derzeit manuell unter <a href=\"%url=modules.php?module
                                break;
 
                        case '0.0.9': // SQL queries for v0.0.9
-                               addGuestMenuSql('main','mediadata','Mediendaten','N','N',3);
+                               addGuestMenuSql('main', 'mediadata', 'Mediendaten', 3);
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Men&uuml;punkt wird durch diese Erweiterung generiert.");
@@ -151,14 +150,14 @@ Bitte stellen Sie diesen derzeit manuell unter <a href=\"%url=modules.php?module
        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 detected.", getExtensionMode()));
+               reportBug(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
 } // END - switch