Some typos fixed
[mailer.git] / inc / extensions / ext-sql_patches.php
index 92b8b05ed591d3391497f9017b5c923c263becb0..99e1111bd822e4c47a983c8e1fe6c7667c5b5bb2 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.5.9";
+$EXT_VERSION = "0.6.1";
 
 // Auto-set extension version
 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = 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", "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", "0.5.7", "0.5.8", "0.5.9");
+$EXT_VER_HISTORY = 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", "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", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -149,7 +149,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` CHANGE auto_purge auto_purge BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day')*14)."";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "In der Tabelle <STRONG>"._MYSQL_PREFIX."_config</STRONG> musste die Spalte <STRONG>auto_purge</STRONG> (autom. L&ouml;schen von Best&auml;tigungsmails angepasst werden (war auf dem Testsystem auf TINYINT(4) gesetzt.)";
+               $UPDATE_NOTES = "In der Tabelle <strong>"._MYSQL_PREFIX."_config</strong> musste die Spalte <strong>auto_purge</strong> (autom. L&ouml;schen von Best&auml;tigungsmails angepasst werden (war auf dem Testsystem auf TINYINT(4) gesetzt.)";
                break;
 
        case "0.0.3": // SQL queries for v0.0.3
@@ -163,7 +163,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mails_page BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Anzahl Mails pro Seite in <STRONG>EMail-Details ansehen</STRONG> und <STRONG>EMail-Archiv</STRONG> hinzugef&uuml;gt.";
+               $UPDATE_NOTES = "Anzahl Mails pro Seite in <strong>EMail-Details ansehen</strong> und <strong>EMail-Archiv</strong> hinzugef&uuml;gt.";
                break;
 
        case "0.0.5": // SQL queries for v0.0.5
@@ -189,10 +189,10 @@ case "update": // Update an extension
                break;
 
        case "0.0.8": // SQL queries for v0.0.8
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD menu_blur_spacer VARCHAR(255) NOT NULL DEFAULT '&nbsp;<STRONG><BIG>&middot;</BIG></STRONG>&nbsp;'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD menu_blur_spacer VARCHAR(255) NOT NULL DEFAULT '&nbsp;<strong><BIG>&middot;</BIG></strong>&nbsp;'";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Nette Mouse-Hover-Effekte eingebaut (Anleitung <STRONG>MENUE_HOVER.txt</STRONG> zum Patchen der general.css bitte lesen!)";
+               $UPDATE_NOTES = "Nette Mouse-Hover-Effekte eingebaut (Anleitung <strong>MENUE_HOVER.txt</strong> zum Patchen der general.css bitte lesen!)";
                break;
 
        case "0.0.9": // SQL queries for v0.0.9
@@ -215,7 +215,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD index_cookie BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day')*365)."";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sie k&ouml;nnen nun <A href=\"".URL."/modules.php?module=admin&amp;`what`=config_home\">hier</A> die Verz&ouml;gerungszeit in der <A href=\"".URL."/index.php\">Eingangsseite</A> einstellen.";
+               $UPDATE_NOTES = "Sie k&ouml;nnen nun <a href=\"{!URL!}/modules.php?module=admin&amp;`what`=config_home\">hier</a> die Verz&ouml;gerungszeit in der <a href=\"{!URL!}/index.php\">Eingangsseite</a> einstellen.";
                break;
 
        case "0.1.2": // SQL queries for v0.1.2
@@ -242,7 +242,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP ext_has_admin";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Spalte <U>ext_has_admin</U> aus der Tabelle <U>"._MYSQL_PREFIX."_extensions</U> entfernt, da sie keinen Sinn mehr macht.";
+               $UPDATE_NOTES = "Spalte <u>ext_has_admin</u> aus der Tabelle <u>"._MYSQL_PREFIX."_extensions</u> entfernt, da sie keinen Sinn mehr macht.";
                break;
 
        case "0.1.6": // SQL queries for v0.1.6
@@ -255,7 +255,7 @@ case "update": // Update an extension
                $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_title','Seitentitel &auml;ndern','De-/aktivieren Sie hier die Dekorationen, sowie Modul-Titel und what-Titel im Seitentitel.', 8)";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Dekorationen des Seitentiteles lassen sich ein- und ausschalten und selber definieren; Modul-Titel und Titel der <STRONG>what</STRONG>-Dateien kann hinzugef&uuml;gt werden.";
+               $UPDATE_NOTES = "Dekorationen des Seitentiteles lassen sich ein- und ausschalten und selber definieren; Modul-Titel und Titel der <strong>what</strong>-Dateien kann hinzugef&uuml;gt werden.";
                break;
 
        case "0.1.7": // SQL queries for v0.1.7
@@ -317,7 +317,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD img_type ENUM('jpg','png') NOT NULL DEFAULT '".$auto_type."'";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Generierung des Mailbest&auml;tigungscodes h&auml;ngt davon ab, ob die PHP-Funktion <U>imagecreatefromjpeg()</U> und das JPEG-Bild vorhanden sind oder nicht.";
+               $UPDATE_NOTES = "Generierung des Mailbest&auml;tigungscodes h&auml;ngt davon ab, ob die PHP-Funktion <u>imagecreatefromjpeg()</u> und das JPEG-Bild vorhanden sind oder nicht.";
                break;
 
        case "0.2.5": // SQL queries for v0.2.5
@@ -325,7 +325,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE max_mails max_mails BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Spalten <U>max_mails</U> und <U>receive_mails</U> auf BIGINT(20) gesetzt.";
+               $UPDATE_NOTES = "Spalten <u>max_mails</u> und <u>receive_mails</u> auf BIGINT(20) gesetzt.";
                break;
 
        case "0.2.6": // SQL queries for v0.2.6
@@ -340,10 +340,10 @@ case "update": // Update an extension
                $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET `what`='config_stats' WHERE `what`='stats' LIMIT 1";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "<OL>
-<LI>Das Mitglied kann das derzeitige Design in sein Profil abspeichern.</LI>
-<LI>Mitgliederstatistik mit Seitennavigation.</LI>
-</OL>";
+               $UPDATE_NOTES = "<ol>
+<li>Das Mitglied kann das derzeitige Design in sein Profil abspeichern.</li>
+<li>Mitgliederstatistik mit Seitennavigation.</li>
+</ol>";
                break;
 
        case "0.2.8": // SQL queries for v0.2.8
@@ -359,7 +359,7 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mt_word3 VARCHAR(255) NOT NULL DEFAULT 'Mailtauscher'";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "W&ouml;rter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
+               $UPDATE_NOTES = "W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.";
                break;
 
        case "0.3.0": // SQL queries for v0.3.0
@@ -587,11 +587,8 @@ PRIMARY KEY (id)
                break;
 
        case "0.4.7": // SQL queries for v0.4.7
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD login_failtures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_failture TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
-
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehlgeschlagene Login-Versuche werden nun mitgez&auml;hlt und der letzte vermerkt.";
+               $UPDATE_NOTES = "Veraltetes Update.";
                break;
 
        case "0.4.8": // SQL queries for v0.4.8
@@ -702,6 +699,24 @@ PRIMARY KEY (`filter_id`)
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Tabellen f&uuml;r Filter-System hinzugef&uuml;gt.";
                break;
+
+       case "0.6.0": // SQL queries for v0.6.0
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_filters` ADD `filter_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `update_filter_usage` ENUM('N','Y') NOT NULL DEFAULT 'N'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Benutzungsstatistik eingebaut. Das Z&auml;hlen der Filterverwendungen sollte <strong>ausschliesslich</strong> zu Debugging-Zwecken eingesetzt werden.";
+               break;
+
+       case "0.6.1": // SQL queries for v0.6.1
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP login_failtures";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP last_failture";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD login_failures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_failure TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Falsche Schreibweise korregiert.";
+               break;
        }
        break;
 
@@ -716,10 +731,14 @@ default: // Do stuff when extension is loaded
 
                // Read key from secret file
                if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
+                       // Cache instance
+                       global $cacheInstance;
+
                        // Maybe need setup of secret key!
                        require_once(PATH."inc/gen_sql_patches.php");
 
-                       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (is_object($cacheInstance))) {
+                       // @TODO Rewrite this to a filter!
+                       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheInstance)) && (is_object($cacheInstance))) {
                                // Remove extensions and mod_reg cache file
                                require_once(PATH."inc/libs/cache_functions.php");
                                require_once(PATH."inc/extensions/ext-cache.php");
@@ -734,7 +753,7 @@ default: // Do stuff when extension is loaded
                        $hashFile = sprintf("%sinc/.secret/.%s", PATH, getConfig('file_hash'));
                        if (FILE_READABLE($hashFile)) {
                                // Read file
-                               $_CONFIG['secret_key'] = implode("", file($hashFile));
+                               $_CONFIG['secret_key'] = READ_FILE($hashFile);
                        } else {
                                // Remove it from database
                                UPDATE_CONFIG("file_hash", "");