From c6e62b16b4474ead6b180a5b9648906459d846da Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 25 Jun 2011 20:45:11 +0000 Subject: [PATCH 1/1] Wrapper functions introduced for configuration, loaders refactured: - Introduced addConfigDropSql() and addConfigChangeSql() to encapsulate dropping and changing database configuration entries - Refactured header (abort lines) for all loaders - TODOs.txt updated --- DOCS/TODOs.txt | 8 ++++---- inc/extensions-functions.php | 24 ++++++++++++++++++++++++ inc/extensions/ext-beg.php | 18 +++++++++--------- inc/extensions/ext-bonus.php | 28 +++++++++++++++------------- inc/extensions/ext-cache.php | 16 ++++++++-------- inc/extensions/ext-coupon.php | 1 + inc/extensions/ext-network.php | 2 +- inc/extensions/ext-order.php | 4 ++-- inc/extensions/ext-other.php | 2 +- inc/extensions/ext-sql_patches.php | 13 +++++++------ inc/language-functions.php | 21 +++++++++++++-------- inc/loader/load- | 8 ++++---- inc/loader/load-admins.php | 8 ++++---- inc/loader/load-config.php | 6 +++--- inc/loader/load-extension.php | 8 ++++---- inc/loader/load-filter.php | 8 ++++---- inc/loader/load-imprint.php | 6 +++--- inc/loader/load-modules.php | 8 ++++---- inc/loader/load-refdepths.php | 6 +++--- inc/loader/load-refsystem.php | 6 +++--- inc/loader/load-themes.php | 6 +++--- 21 files changed, 120 insertions(+), 87 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 51cb2017b3..5b0ff8573f 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -42,7 +42,7 @@ ./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table? ./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y'); ./inc/extensions-functions.php:155: // @TODO Do we still need this? setExtensionUpdateNotes(''); -./inc/extensions-functions.php:1915:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable' +./inc/extensions-functions.php:1939:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable' ./inc/extensions-functions.php:437:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) ./inc/extensions-functions.php:567: // @TODO Extension is loaded, what next? ./inc/filter/bonus_filter.php:55: // @TODO This query isn't right, it will only update if the user was for a longer time away! @@ -60,7 +60,7 @@ ./inc/language/de.php:1083: // @TODO Rewrite these two constants ./inc/language/de.php:1104: // @TODO Rewrite these three constants ./inc/language/de.php:778:// @TODO Are these constants longer used? -./inc/language-functions.php:250: // @TODO These are all valid languages, again hard-coded +./inc/language-functions.php:255: // @TODO These are all valid languages, again hard-coded ./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function. ./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no * ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings * @@ -142,8 +142,8 @@ ./inc/modules/admin/what-list_links.php:85: // @TODO Find a way to rewrite this. See some lines above for different queries ./inc/modules/admin/what-list_links.php:94: // @TODO Rewrite this to includes/filter ./inc/modules/admin/what-list_refs.php:107: // @TODO Try to rewrite some to EL -./inc/modules/admin/what-list_unconfirmed.php:80: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}'); -./inc/modules/admin/what-list_unconfirmed.php:99: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus +./inc/modules/admin/what-list_unconfirmed.php:107: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus +./inc/modules/admin/what-list_unconfirmed.php:84: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}'); ./inc/modules/admin/what-list_user.php:153: // @TODO Rewrite these to filters ./inc/modules/admin/what-list_user.php:261: // @TODO Rewrite this into a filter ./inc/modules/admin/what-list_user.php:309: // @TODO Rewrite this into a filter diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 3a4c95efe8..9228cf4f42 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -1910,6 +1910,30 @@ function addConfigAddSql ($columnName, $columnSql) { } } +// Drop configuration entry if found for actual extension +function addConfigDropSql ($columnName) { + // Is the column there? + if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) { + // Found, so add it + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `' . $columnName . '`'); + } else { + // Add debug line, debug_report_bug() would cause some extenion updates fail + logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' not found.'); + } +} + +// Change configuration entry for actual extension +function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) { + // Is the old column there? + if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $oldColumnName)) { + // Found so add it + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `' . $oldColumnName . '` `' . $newColumnName . '` ' . $columnSql); + } else { + // Add debug line, debug_report_bug() would cause some extenion updates fail + logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $oldColumnName . ' not found.'); + } +} + // Enables/disables productive mode for current extension (used only while // registration). // @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable' diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 249dd1a9f6..ca950408bc 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -260,21 +260,21 @@ PRIMARY KEY (`id`) break; case '0.2.7': // SQL queries for v0.2.7 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `beg_ral_en_notify` `beg_ral_enable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `beg_ral_di_notify` `beg_ral_disable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `beg_new_mem_notify` `beg_new_member_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_en_notify` `beg_ral_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_di_notify` `beg_ral_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigChangeSql('beg_ral_en_notify', 'beg_ral_enable_notify`', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('beg_ral_di_notify', 'beg_ral_disable_notify`', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('beg_new_mem_notify', 'beg_new_member_notify`', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_en_notify` `beg_ral_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_di_notify` `beg_ral_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Umbenannt nach neuer Namenskonvention"); break; case '0.2.8': // SQL queries for v0.2.8 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `beg_ral_enable_notify` `beg_rallye_enable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `beg_ral_disable_notify` `beg_rallye_disable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_enable_notify` `beg_rallye_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_disable_notify` `beg_rallye_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigChangeSql('beg_ral_enable_notify', 'beg_rallye_enable_notify`', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('beg_ral_disable_notify', 'beg_rallye_disable_notify`', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_enable_notify` `beg_rallye_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `beg_ral_disable_notify` `beg_rallye_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Umbenannt nach neuer Namenskonvention"); diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 7e6d7d444c..3e0e3b9260 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -196,11 +196,13 @@ INDEX `userid` (`userid`) case '0.2.8': // SQL queries for v0.2.8 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `timestamp`=0 WHERE `timestamp`='0000000000'"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus_turbo` CHANGE `points` `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `turbo_bonus` `turbo_bonus` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `login_bonus` `login_bonus` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `turbo_bonus` `turbo_bonus` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `login_bonus` `login_bonus` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); + // For configuration, we need different entries + addConfigChangeSql('turbo_bonus', 'turbo_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + addConfigChangeSql('login_bonus', 'login_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + // Update notes (these will be set as task text!) setExtensionUpdateNotes("5 Nachkommastellen implementiert"); break; @@ -567,35 +569,35 @@ ORDER BY break; case '0.9.1': // SQL queries for v0.9.1 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `bonus_en_notify` `bonus_enable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `bonus_di_notify` `bonus_disable_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `bonus_new_mem_notify` `bonus_new_member_notify` ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('bonus_en_notify', 'bonus_enable_notify', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('bonus_di_notify', 'bonus_disable_notify', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addConfigChangeSql('bonus_new_mem_notify', 'bonus_new_member_notify', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); // Update notes setExtensionUpdateNotes("Umbenannt nach neuer Konvention (bitte Einstellungen kontrollieren)."); break; case '0.9.2': // SQL queries for v0.9.2 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_en_notify` `bonus_ralley_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_di_notify` `bonus_ralley_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_notify` `bonus_rallley_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_en_notify` `bonus_ralley_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_di_notify` `bonus_ralley_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ral_notify` `bonus_rallley_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); // Update notes setExtensionUpdateNotes("Umbenannt nach neuer Konvention (bitte Einstellungen kontrollieren)."); break; case '0.9.3': // SQL queries for v0.9.3 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ralley_enable_notify` `bonus_rallye_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ralley_disable_notify` `bonus_rallye_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `bonus_ralley_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ralley_enable_notify` `bonus_rallye_enable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `bonus_ralley_disable_notify` `bonus_rallye_disable_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `bonus_ralley_notify` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); // Update notes setExtensionUpdateNotes("Typos gefixt."); break; case '0.9.4': // SQL queries for v0.9.4 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `bonus_id` `bonus_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL"); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `bonus_id`=NULL WHERE `bonus_id`=0"); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `bonus_id` `bonus_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL'); + addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `bonus_id`=NULL WHERE `bonus_id`=0'); // Update notes setExtensionUpdateNotes("Konfliktierende SQL-Befehle aus ext-user verschoben."); diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 8d631beaac..29221d4fdf 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -232,14 +232,14 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_cache' LIMIT 1"); // Remove config entries - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_themes`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_admins`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_acls`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_exts`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_config`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_modreg`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refdepth`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refsys`"); + addConfigDropSql('cache_themes'); + addConfigDropSql('cache_admins'); + addConfigDropSql('cache_acls'); + addConfigDropSql('cache_exts'); + addConfigDropSql('cache_config'); + addConfigDropSql('cache_modreg'); + addConfigDropSql('cache_refdepth'); + addConfigDropSql('cache_refsys'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Der Cache hat keine Konfiguration mehr."); diff --git a/inc/extensions/ext-coupon.php b/inc/extensions/ext-coupon.php index bf1bfc77ba..8aa9642804 100644 --- a/inc/extensions/ext-coupon.php +++ b/inc/extensions/ext-coupon.php @@ -80,6 +80,7 @@ UNIQUE KEY (`coupon_code`) ) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Coupon->user connection'"); // Configuration entries + //addConfigAddSql('', ""); // Menu systems: // - Admin entries diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 96e230a085..3e09c8c06e 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -4843,7 +4843,7 @@ PRIMARY KEY (`network_reload_id`) addAdminMenuSql('network','list_network_error_types','Fehlertypen','Experten-Einstellungen! Hier stellen Sie die Namen von Fehlercodes ein, die Scripte zurückliefern können. Dies sind INTERNE Daten und sollten nur vom Entwicklerteam angepasst werden. Stellen Sie an diesen Einstellungen bitte nichts um. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',12); // Configuration entries - addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `network_cache_refresh` BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 15) . ''); + addConfigAddSql('network_cache_refresh', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 15)); break; case 'remove': // Do stuff when removing extension diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index a7c72ed4a0..085a001bb8 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -314,8 +314,8 @@ INDEX (`pool_id`) break; case '0.5.2': // SQL queries for v0.5.2 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_text`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_subj`"); + addConfigDropSql('test_text'); + addConfigDropSql('test_subj'); addConfigAddSql('allow_url_in_text', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); addConfigAddSql('allow_url_in_subject', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index b7a4ff2091..f3ae6254d9 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -186,7 +186,7 @@ switch (getExtensionMode()) { break; case '0.2.0': // SQL queries for v0.2.0 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `mailid_error_redirect` `mailid_error_redirect` ENUM('INDEX','REJECT') NOT NULL DEFAULT 'INDEX'"); + addConfigChangeSql('mailid_error_redirect', 'mailid_error_redirect', "ENUM('INDEX','REJECT') NOT NULL DEFAULT 'INDEX'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Bei fehlerhafter Mail während der Bestätigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden."); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index d9f1abbb6b..2c2ce2db01 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -116,7 +116,7 @@ switch (getExtensionMode()) { break; case '0.0.2': // SQL queries for v0.0.2 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `auto_purge` `auto_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*14).""); + addConfigChangeSql('auto_purge', 'auto_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay()*14)); // Update notes (these will be set as task text!) setExtensionUpdateNotes("In der Tabelle {?_MYSQL_PREFIX?}_config musste die Spalte auto_purge (autom. Löschen von Bestätigungsmails angepasst werden (war auf dem Testsystem auf TINYINT(4) gesetzt.)"); @@ -671,7 +671,7 @@ PRIMARY KEY (`filter_id`) break; case '0.6.5': // SQL queries for v0.6.5 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `css_php` `css_php` ENUM('DIRECT','FILE','INLINE') NOT NULL DEFAULT 'FILE'"); + addConfigChangeSql('css_php', 'css_php', "ENUM('DIRECT','FILE','INLINE') NOT NULL DEFAULT 'FILE'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Ausgabe der CSS-Dateien entweder per css.php oder sie sind direkt eingebunden."); @@ -687,7 +687,8 @@ PRIMARY KEY (`filter_id`) break; case '0.6.7': // SQL queries for v0.6.7 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `index_delay` `index_delay` TINYINT(3) NOT NULL DEFAULT 0"); + addConfigChangeSql('index_delay', 'index_delay', 'TINYINT(3) NOT NULL DEFAULT 0'); + // Update notes (these will be set as task text!) setExtensionUpdateNotes("Die Weiterleitungseinstellung muss auch Werte kleiner Null akzeptieren."); break; @@ -724,7 +725,7 @@ INDEX (`ip`) ) ENGINE = {?_TABLE_TYPE?}"); // Configuration - addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `dns_cache_timeout` BIGINT(20) NOT NULL DEFAULT ' . (60*60*24)); + addConfigAddSql('dns_cache_timeout', 'BIGINT(20) NOT NULL DEFAULT ' . (60*60*24)); // Register filter registerFilter('reset', 'CLEANUP_DNS_CACHE', false, true, isExtensionDryRun()); @@ -771,8 +772,8 @@ INDEX (`ip`) break; case '0.7.6': // SQL queries for v0.7.6 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `last_month` `last_month` TINYINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT 00"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `last_week` `last_week` TINYINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT 00"); + addConfigChangeSql('last_month', 'last_month', 'TINYINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT 00'); + addConfigChangeSql('last_week', 'last_week', 'TINYINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT 00'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Spaltentyp fuer kleine Zahlen sollten auch z.B. TINYINT sein."); diff --git a/inc/language-functions.php b/inc/language-functions.php index 6d57354769..29e07cf33a 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -111,10 +111,15 @@ function setCurrentLanguage ($language) { $GLOBALS['language'] = (string) $language; } +// Checks wether current language is set +function isCurrentLanguageSet () { + return (isset($GLOBALS['language'])); +} + // "Getter" for language function getLanguage () { // Do we have cache? - if (!isset($GLOBALS['language'])) { + if (!isCurrentLanguageSet()) { // Default is 'de'. DO NOT CHANGE THIS!!! $ret = 'de'; @@ -124,17 +129,17 @@ function getLanguage () { } // END - if // Is the variable set - if (isGetRequestParameterSet('mx_lang')) { + if (isGetRequestParameterSet('mailer_lang')) { // Accept only first 2 chars - $ret = substr(getRequestParameter('mx_lang'), 0, 2); - } elseif (isset($GLOBALS['language'])) { + $ret = substr(getRequestParameter('mailer_lang'), 0, 2); + } elseif (isCurrentLanguageSet()) { // Use cached $ret = getCurrentLanguage(); - } elseif (isSessionVariableSet('mx_lang')) { + } elseif (isSessionVariableSet('mailer_lang')) { // Return stored value from cookie - $ret = getSession('mx_lang'); + $ret = getSession('mailer_lang'); - // Fixes a warning before the session has the mx_lang constant + // Fixes a warning before the session has the mailer_lang constant if (empty($ret)) { $ret = getDefaultLanguage(); } // END - if @@ -154,7 +159,7 @@ function setLanguage ($lang) { $lang = substr(secureString($lang), 0, 2); // Set cookie - setSession('mx_lang', $lang); + setSession('mailer_lang', $lang); } // Checks wether a language file is there for optional extension diff --git a/inc/loader/load- b/inc/loader/load- index d1c1fc375e..e3c73b03af 100644 --- a/inc/loader/load- +++ b/inc/loader/load- @@ -38,10 +38,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} // END - if - -// Use this code if you don't want to run this cache loader on installation phase -//if (isInstallationPhase()) return; +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; +} // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_instance']->extensionVersionMatches('foo'))) { diff --git a/inc/loader/load-admins.php b/inc/loader/load-admins.php index 0ae03bdffe..eb3d516155 100644 --- a/inc/loader/load-admins.php +++ b/inc/loader/load-admins.php @@ -38,10 +38,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} // END - if - -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; +} // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_instance']->extensionVersionMatches('admins'))) { diff --git a/inc/loader/load-config.php b/inc/loader/load-config.php index 550f6028b2..6c61f8ea2d 100644 --- a/inc/loader/load-config.php +++ b/inc/loader/load-config.php @@ -38,11 +38,11 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; } -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; - // Next cached table is the configuration (config)... if (($GLOBALS['cache_instance']->loadCacheFile('config')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load config from cache diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php index 9bc2bd3ed2..aad9cd0ab7 100644 --- a/inc/loader/load-extension.php +++ b/inc/loader/load-extension.php @@ -40,10 +40,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} // END - if - -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; +} // Next cached table is the extension if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { diff --git a/inc/loader/load-filter.php b/inc/loader/load-filter.php index 3d40cf2ece..169596961b 100644 --- a/inc/loader/load-filter.php +++ b/inc/loader/load-filter.php @@ -38,10 +38,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} // END - if - -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; +} // Next cached table is the filteruration (filter)... if (($GLOBALS['cache_instance']->loadCacheFile('filter')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { diff --git a/inc/loader/load-imprint.php b/inc/loader/load-imprint.php index 0389e5e701..80de83f533 100644 --- a/inc/loader/load-imprint.php +++ b/inc/loader/load-imprint.php @@ -38,14 +38,14 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; } elseif (!isExtensionInstalled('imprint')) { // Not not cache if not installed! return; } -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; - // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('imprint')) && ($GLOBALS['cache_instance']->extensionVersionMatches('imprint'))) { // Load cache diff --git a/inc/loader/load-modules.php b/inc/loader/load-modules.php index 2dda2da8d6..a0831eae22 100644 --- a/inc/loader/load-modules.php +++ b/inc/loader/load-modules.php @@ -38,10 +38,10 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} // END - if - -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; +} // Next cached table is the module registry (mod_reg)... if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { diff --git a/inc/loader/load-refdepths.php b/inc/loader/load-refdepths.php index d0109672e5..e563c8737d 100644 --- a/inc/loader/load-refdepths.php +++ b/inc/loader/load-refdepths.php @@ -38,11 +38,11 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; } -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; - // Next cached table is the referal system (refdepths)... if (($GLOBALS['cache_instance']->loadCacheFile('refdepths')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache diff --git a/inc/loader/load-refsystem.php b/inc/loader/load-refsystem.php index 55cf614561..0cef9084bd 100644 --- a/inc/loader/load-refsystem.php +++ b/inc/loader/load-refsystem.php @@ -38,11 +38,11 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; } -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; - // Next cached table is the referal system (refsystem)... if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache diff --git a/inc/loader/load-themes.php b/inc/loader/load-themes.php index 0deca53068..4461adc71c 100644 --- a/inc/loader/load-themes.php +++ b/inc/loader/load-themes.php @@ -38,14 +38,14 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); +} elseif (isInstallationPhase()) { + // Use this code if you don't want to run this cache loader on installation phase + return; } elseif (!isExtensionActive('theme')) { // Skip this loader return false; } -// Use this code if you don't want to run this cache loader on installation phase -if (isInstallationPhase()) return; - // Next cached table is the referal system (themes)... if (($GLOBALS['cache_instance']->loadCacheFile('themes')) && ($GLOBALS['cache_instance']->extensionVersionMatches('theme'))) { // Load referal system from cache -- 2.30.2