]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-register.php
A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / extensions / ext-register.php
index 19f53c8fea84b2363f278cb00e343a70b81571dc..6a42dd815700fc2c00beec84838c5b72261c55ef 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 04/29/2004 *
- * ================                             Last change: 11/23/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 04/29/2004 *
+ * ===================                          Last change: 11/23/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-register.php                                 *
  * $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                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -42,55 +41,55 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.5.4');
+setThisExtensionVersion('0.5.6');
 
-// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6'));
 
 switch (getExtensionMode()) {
-       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+       case 'register': // Do stuff when installation is running
                // SQL commands to run
-               addExtensionSql('');
+               addGuestMenuSql('members', 'register', 'Anmeldung', 2);
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_register'");
-               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_register' LIMIT 1");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='register' LIMIT 1");
+               addDropTableSql('must_register');
 
                // Unregister a filter
-               unregisterFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, getExtensionDryRun());
+               unregisterFilter(__FUNCTION__, __LINE__, 'register_must_fillout', 'REGISTER_MUST_FILLOUT', true, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                // SQL commands to run
-               addExtensionSql('');
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `locked`='N', `visible`='Y' WHERE `what`='register' LIMIT 1");
                break;
 
        case 'deactivate': // Do stuff when admin deactivates this extension
                // SQL commands to run
-               addExtensionSql('');
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `locked`='Y', `visible`='N' WHERE `what`='register' LIMIT 1");
                break;
 
        case 'update': // Update an extension
-               switch (getCurrentExtensionVersion())
-               {
+               switch (getCurrentExtensionVersion()) {
                        case '0.1.0': // SQL queries for v0.1
-                               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`");
-                               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_must_register` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-field_name VARCHAR(255) NOT NULL DEFAULT '',
-field_required ENUM('Y','N') NOT NULL DEFAULT 'Y',
-PRIMARY KEY (id)
-) TYPE={?_TABLE_TYPE?}");
+                               addDropTableSql('must_register');
+                               addCreateTableSql('must_register', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`field_name` VARCHAR(255) NOT NULL DEFAULT '',
+`field_required` ENUM('Y','N') NOT NULL DEFAULT 'Y',
+PRIMARY KEY (`id`)",
+                                       'Data which fields the user must fill out');
 
                                // Add all entries as required (DO NOT DELETE THEM FROM DATABASE!)
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('surname','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('family','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('street_nr','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('cntry','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('zip','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('city','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('surname','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('family','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('street_nr','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('cntry','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('zip','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('city','Y')");
 
                                // Add admin menu
                                addAdminMenuSql('setup','config_register','Pflichtfelder','Stellen Sie hier die Pflichtfelder sowohl im Anmeldeformular, als auch im Mitgliedsbereich unter <strong>Profildaten &auml;ndern</strong> ein.', 12);
@@ -100,21 +99,19 @@ PRIMARY KEY (id)
                                break;
 
                        case '0.1.1': // SQL queries for v0.1.1
-                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET ext_has_css='Y' WHERE `ext_name`='register' AND ext_has_css='N' LIMIT 1");
-
-                               // This update depends on sql_patches update!
-                               addExtensionUpdateDependency('sql_patches');
+                               // This update depends on ext-sql_patches update!
+                               addExtensionDependency('sql_patches');
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
+                               setExtensionUpdateNotes("Veraltetes Update entfernt.");
                                break;
 
                        case '0.1.3': // SQL queries for v0.1.3
-                               // This update depends on sql_patches update!
-                               addExtensionUpdateDependency('sql_patches');
+                               // This update depends on ext-sql_patches update!
+                               addExtensionDependency('sql_patches');
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("Standart Referal-Id kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)");
+                               setExtensionUpdateNotes("Standard Referal-Id kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)");
                                break;
 
                        case '0.1.4': // SQL queries for v0.1.4
@@ -209,12 +206,12 @@ PRIMARY KEY (id)
 
                        case '0.3.2': // SQL queries for v0.3.2
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <a href=\"{?URL?}/modules.php?module=admin&amp;what=extensions&amp;do=search\">meiner Seite herunterladen</a> m&uuml;ssen.<br />
+                               setExtensionUpdateNotes("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <strike>meiner Seite herunterladen</strike> m&uuml;ssen.<br />
 <br />
 <strong>Wichtig: Laden Sie noch das Template <strong>guest_register.tpl</strong> mit hoch, welches unter templates/".getLanguage()."/html/guest/ zu finden ist!</strong>");
 
                                // Depends on 'country'
-                               addExtensionUpdateDependency('country');
+                               addExtensionDependency('country');
                                break;
 
                        case '0.3.3': // SQL queries for v0.3.3
@@ -263,10 +260,10 @@ PRIMARY KEY (id)
                                break;
 
                        case '0.4.2': // SQL queries for v0.4.2
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD register_default ENUM('Y','N') NOT NULL DEFAULT 'N'");
+                               addConfigAddSql('register_default', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("Bei der Anmeldung kann die Standart-Auswahl zwischen Ja/Nein umgeschaltet werden. Das &Auml;ndern des Templates <strong>templates/".getLanguage()."/html/guest/guest_register.tpl</strong> ist nicht mehr n&ouml;tig.");
+                               setExtensionUpdateNotes("Bei der Anmeldung kann die Standard-Auswahl zwischen Ja/Nein umgeschaltet werden. Das &Auml;ndern des Templates <strong>templates/".getLanguage()."/html/guest/guest_register.tpl</strong> ist nicht mehr n&ouml;tig.");
                                break;
 
                        case '0.4.3': // SQL queries for v0.4.3
@@ -321,39 +318,55 @@ PRIMARY KEY (id)
 
                        case '0.5.3': // SQL queries for v0.5.3
                                // Register a filter
-                               registerFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, getExtensionDryRun());
+                               registerFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, isExtensionDryRun());
 
                                // Run these SQLs
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('gender','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('email','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('birthday','Y')");
-                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('marker','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('gender','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('email','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('birthday','Y')");
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`,`field_required`) VALUES ('marker','Y')");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter <strong>register_must_fillout</strong> hinzugef&uuml;gt, weitere Felder in <em>{?_MYSQL_PREFIX?}_must_register</em> eingef&uuml;gt.");
                                break;
 
                        case '0.5.4': // SQL queries for v0.5.4
-                               addAdminMenuSql('setup','config_register2','Anmeldeformular','Stellen Sie ein, wie viel Kategorien der Gast bei der Anmeldung mindestens einstellen muss. Diese Einstellung gilt nachher auch im Mitgliedsbereich!',8);
+                               addAdminMenuSql('setup', 'config_register2', 'Anmeldeformular', 'Stellen Sie ein, wie viel Kategorien der Gast bei der Anmeldung mindestens einstellen muss. Diese Einstellung gilt nachher auch im Mitgliedsbereich!', 8);
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Weiteren Men&uuml;punkt aus <strong>menu-{?DEFAULT_LANG?} heraus geholt.");
                                break;
 
+                       case '0.5.5': // SQL queries for v0.5.5
+                               addConfigAddSql('register_generate_password_empty', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Weiteren Men&uuml;punkt aus <strong>menu-{?DEFAULT_LANG?} heraus geholt.");
+                               break;
+
+                       case '0.5.6': // SQL queries for v0.5.6
+                               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('register_welcome','points','LOCKED','DIRECT')");
+
+                               // This depends on ext-sql_patches
+                               addExtensionDependency('sql_patches');
+
+                               // Update notes
+                               setExtensionUpdateNotes("Anmeldewillkommensgutschrift wird nun &uuml;ber die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
+                               break;
                } // END - switch
                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.
+       case 'test': // For testing purposes
                break;
 
        case 'init': // Do stuff when extension is initialized
                break;
 
        default: // Unknown extension mode
-               DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
 } // END - switch