From 3b85bd5030ad591b0c5cb038ca534a7b50e1b319 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 16 Dec 2008 20:32:42 +0000 Subject: [PATCH] Heavily rewritten API: - Extensions can now be tested (used while extension is being installed) - Flexible filter system added which is database-based - All "theme-extension-related" functions are now moved to inc/libs/theme_functions.php to follow more the "inoffical" guidelines: + Write in extensions! + Use the new filter system! + Write your own functions ALL_UPPER_CASE to avoid confusion with php_internal_functions! - This is a half-finished update, I will change later more places to the filter system. - THINK: Do we need to externalize the session management into an own extension? - inc/theme-manager.php is now deprecated - Dummy include file inc/theme-dummy.php will be loaded if no extension "theme" is loaded which returns values for default theme. - Minor fixes/improvements --- .gitattributes | 4 + beg.php | 2 +- inc/autopurge.php | 2 +- inc/databases.php | 2 +- inc/extensions.php | 37 +-- inc/extensions/ext- | 3 + inc/extensions/ext-active.php | 3 + inc/extensions/ext-admins.php | 3 + inc/extensions/ext-admintheme1.php | 3 + inc/extensions/ext-admintheme_default.php | 3 + inc/extensions/ext-autopurge.php | 3 + inc/extensions/ext-bank.php | 3 + inc/extensions/ext-beg.php | 3 + inc/extensions/ext-birthday.php | 3 + inc/extensions/ext-bonus.php | 3 + inc/extensions/ext-booking.php | 3 + inc/extensions/ext-cache.php | 30 ++- inc/extensions/ext-country.php | 3 + inc/extensions/ext-debug.php | 3 + inc/extensions/ext-demo.php | 3 + inc/extensions/ext-doubler.php | 3 + inc/extensions/ext-events.php | 3 + inc/extensions/ext-holiday.php | 3 + inc/extensions/ext-html_mail.php | 4 +- inc/extensions/ext-iso3166.php | 3 + inc/extensions/ext-mailid.php | 3 + inc/extensions/ext-maintenance.php | 3 + inc/extensions/ext-mediadata.php | 13 +- inc/extensions/ext-mods.php | 3 + inc/extensions/ext-mydata.php | 3 + inc/extensions/ext-newsletter.php | 6 +- inc/extensions/ext-nickname.php | 3 + inc/extensions/ext-online.php | 3 + inc/extensions/ext-optimize.php | 3 + inc/extensions/ext-order.php | 6 +- inc/extensions/ext-other.php | 3 + inc/extensions/ext-payout.php | 3 + inc/extensions/ext-primera.php | 3 + inc/extensions/ext-profile.php | 6 +- inc/extensions/ext-rallye.php | 10 +- inc/extensions/ext-refback.php | 3 + inc/extensions/ext-register.php | 3 + inc/extensions/ext-removeip.php | 3 + inc/extensions/ext-repair.php | 3 + inc/extensions/ext-rewrite.php | 3 + inc/extensions/ext-safe.php | 3 + inc/extensions/ext-sponsor.php | 3 + inc/extensions/ext-sql_patches.php | 120 ++++----- inc/extensions/ext-support.php | 3 + inc/extensions/ext-surfbar.php | 3 + inc/extensions/ext-task.php | 3 + inc/extensions/ext-theme.php | 56 +++- inc/extensions/ext-top10.php | 3 + inc/extensions/ext-transfer.php | 3 + inc/extensions/ext-user.php | 3 + inc/extensions/ext-wernis.php | 10 +- inc/extensions/ext-yoomedia.php | 3 + inc/filters.php | 250 +++++++++++++++++ inc/footer.php | 24 +- inc/functions.php | 36 +-- inc/install-inc.php | 3 - inc/language/de.php | 9 + inc/libs/admins_functions.php | 8 +- inc/libs/cache_functions.php | 23 ++ inc/libs/country_functions.php | 26 +- inc/libs/events_functions.php | 41 +++ inc/libs/task_functions.php | 2 +- inc/libs/theme_functions.php | 312 ++++++++++++++++++++++ inc/load_extensions.php | 4 +- inc/modules/admin.php | 12 +- inc/modules/admin/admin-inc.php | 3 + inc/modules/admin/what-admins_add.php | 18 +- inc/modules/admin/what-extensions.php | 2 +- inc/mysql-connect.php | 42 ++- inc/mysql-manager.php | 20 +- inc/stylesheet.php | 8 +- inc/theme-dummy.php | 50 ++++ inc/theme-manager.php | 287 +------------------- 78 files changed, 1106 insertions(+), 508 deletions(-) create mode 100644 inc/filters.php create mode 100644 inc/libs/events_functions.php create mode 100644 inc/libs/theme_functions.php create mode 100644 inc/theme-dummy.php diff --git a/.gitattributes b/.gitattributes index 7e7e3213b6..160df8a5fa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -149,6 +149,7 @@ inc/extensions/ext-user.php -text inc/extensions/ext-wernis.php -text inc/extensions/ext-yoomedia.php -text inc/fatal_errors.php -text +inc/filters.php -text inc/footer.php -text inc/functions.php -text inc/gen_mediadata.php -text @@ -217,6 +218,7 @@ inc/libs/cache_functions.php -text inc/libs/country_functions.php -text inc/libs/debug_functions.php -text inc/libs/doubler_functions.php -text +inc/libs/events_functions.php -text inc/libs/holiday_functions.php -text inc/libs/html_mail_functions.php -text inc/libs/mediadata_functions.php -text @@ -235,6 +237,7 @@ inc/libs/security_functions.php -text inc/libs/sponsor_functions.php -text inc/libs/surfbar_functions.php -text inc/libs/task_functions.php -text +inc/libs/theme_functions.php -text inc/libs/transfer_functions.php -text inc/libs/user_functions.php -text inc/libs/wernis_functions.php -text @@ -601,6 +604,7 @@ inc/session.php -text inc/sql_error.php -text inc/stats_bonus.php -text inc/stylesheet.php -text +inc/theme-dummy.php -text inc/theme-manager.php -text inc/weekly/.htaccess -text inc/weekly/weekly_ -text diff --git a/beg.php b/beg.php index 4b2a5d5f6b..440e7328da 100644 --- a/beg.php +++ b/beg.php @@ -87,7 +87,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { $status = "failed"; // Check if account was found - if ((SQL_NUMROWS($result) == 1) && ($result != false)) { + if (SQL_NUMROWS($result) == 1) { // Found an ID so we simply set it list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result); diff --git a/inc/autopurge.php b/inc/autopurge.php index ee4ec0224a..15e1832d90 100644 --- a/inc/autopurge.php +++ b/inc/autopurge.php @@ -53,7 +53,7 @@ if (EXT_IS_ACTIVE("rallye")) { // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!) require_once(PATH."inc/libs/rallye_functions.php"); RALLYE_DELETE_EXPIRED_RALLYES(); -} +} // END - if // ?> diff --git a/inc/databases.php b/inc/databases.php index cb134ee8b3..bfae156198 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "634"); +define('CURR_SVN_REVISION', "635"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 68f89a1954..2906fbf58a 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -43,11 +43,11 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "") { // Is the extension already loaded? //* DEBUG: */ echo "Loading extension {$ext_name}.
\n"; - if (isset($EXT_LOADED[$ext_name])) { + if ((isset($EXT_LOADED[$ext_name])) && (empty($EXT_LOAD_MODE))) { // Debug message DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name)); return false; - } + } // END - if // Construct FQFN for extension file $extInclude = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name); @@ -256,13 +256,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) { } // END - foreach // Remove cache file(s) if extension is active - if ((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) { - //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; - // Remove cache files - if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile(); - } // END - if + RUN_FILTER('post_extension_installed', $ext_name); // Check for added include files if (count($INC_POOL > 0)) { @@ -394,11 +388,8 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { // Remove cache file(s) if extension is active if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($EXT_LOAD_MODE == "activate") || ($EXT_LOAD_MODE == "deactivate"))) { - //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; - // Remove cache files - if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile(); + // Run filters + RUN_FILTER('post_extension_run_sql', $ext_name); // @TODO This causes the whole (!) menu cache being purged CACHE_PURGE_ADMIN_MENU(); @@ -581,17 +572,13 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) { // Update extension's version $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_version='%s' WHERE ext_name='%s' LIMIT 1", - array($EXT_VERSION, $ext), __FILE__, __LINE__); - - // Update cache - if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile(); - if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); - } // END - if + array($EXT_VERSION, $ext), __FILE__, __LINE__); // Remove array unset($SQLs); + + // Run filters on success extension update + RUN_FILTER('extension_update', $ext); } else { // In "dry-run" mode return array with SQL commands return $SQLs; @@ -600,14 +587,14 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) { } // Output verbose SQL table for extension -function EXTENSION_VERBOSE_TABLE($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $WIDTH = "480") { +function EXTENSION_VERBOSE_TABLE ($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "480") { global $_CONFIG; $S = false; $SW = 2; $i = 1; $OUT = ""; if ((is_array($SQLs)) && (GET_EXT_VERSION("sql_patches") >= "0.0.7") && ($_CONFIG['verbose_sql'] == "Y")) { $OUT = "
- +
".$title.": @@ -661,7 +648,7 @@ function GET_EXT_NAME ($id) { } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); + array(bigintval($id)), __FILE__, __LINE__); list($ret) = SQL_FETCHROW($result); SQL_FREERESULT($result); } diff --git a/inc/extensions/ext- b/inc/extensions/ext- index 668e7b87c6..1fefa3bf0c 100644 --- a/inc/extensions/ext- +++ b/inc/extensions/ext- @@ -76,6 +76,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-active.php b/inc/extensions/ext-active.php index c41232f6de..b357a96a52 100644 --- a/inc/extensions/ext-active.php +++ b/inc/extensions/ext-active.php @@ -120,6 +120,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index 2e3777df55..d103d13c34 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -285,6 +285,9 @@ PRIMARY KEY (id) } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-admintheme1.php b/inc/extensions/ext-admintheme1.php index 9bd5fa88b8..72b2300050 100644 --- a/inc/extensions/ext-admintheme1.php +++ b/inc/extensions/ext-admintheme1.php @@ -81,6 +81,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-admintheme_default.php b/inc/extensions/ext-admintheme_default.php index 24f36015ce..5934c04fd1 100644 --- a/inc/extensions/ext-admintheme_default.php +++ b/inc/extensions/ext-admintheme_default.php @@ -81,6 +81,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index c549e7c8e9..eaae7a4177 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -249,6 +249,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Do we have a daily-reset-run? if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) diff --git a/inc/extensions/ext-bank.php b/inc/extensions/ext-bank.php index 1505c5c2de..e3af3054a9 100644 --- a/inc/extensions/ext-bank.php +++ b/inc/extensions/ext-bank.php @@ -184,6 +184,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index fd553900a1..d096f17141 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -259,6 +259,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Remove old entries $OLD = $_CONFIG['beg_timeout']; diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index 0217d46461..cf3da62bed 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -189,6 +189,9 @@ CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) { // Daily reset was run and we shall pay points so we start checking for members who diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 566c4809f3..5fbad0782d 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -536,6 +536,9 @@ WHERE last_online < ".$mark." ORDER BY userid"; } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { // Daily reset was run so let's check if active rallye is activated diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 95d0e1537a..4470efd1be 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -100,6 +100,9 @@ case "update": // Update an extension break; } +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index a22f9dcab2..867bf66a1b 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -39,13 +39,13 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.2.0"; +$EXT_VERSION = "0.2.1"; // Auto-set extension version if (empty($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"); +$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"); switch ($EXT_LOAD_MODE) { @@ -60,6 +60,15 @@ case "register": // Do stuff when installation is running (modules.php?module=ad case "remove": // Do stuff when removing extension // SQL commands to run $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_cache' OR what='cache_stats' LIMIT 2"; + + // Unregister all filters + UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE'); + UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE'); + UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE'); + UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); break; case "activate": // Do stuff when admin activates this extension @@ -199,9 +208,26 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Die Erweiterung hängt nun von der sql_patches ab."; break; + + case "0.2.1": // SQL queries for v0.2.1 + // Register the new filter + REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE'); + REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE'); + REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE'); + REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE'); + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Filter hinzugefügt für Erweiterungsmanagement."; + break; } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Create instance on class if ($cacheMode != "init") { diff --git a/inc/extensions/ext-country.php b/inc/extensions/ext-country.php index 49cd292dcc..d66dc454d5 100644 --- a/inc/extensions/ext-country.php +++ b/inc/extensions/ext-country.php @@ -110,6 +110,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-debug.php b/inc/extensions/ext-debug.php index b93312c63d..3bbc10dac5 100644 --- a/inc/extensions/ext-debug.php +++ b/inc/extensions/ext-debug.php @@ -164,6 +164,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-demo.php b/inc/extensions/ext-demo.php index 0fcbff1d50..d6e8cc589b 100644 --- a/inc/extensions/ext-demo.php +++ b/inc/extensions/ext-demo.php @@ -78,6 +78,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 80f4b1d853..1696640d88 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -234,6 +234,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['doubler_send_mode'] == "RESET")) { // So let's check for points diff --git a/inc/extensions/ext-events.php b/inc/extensions/ext-events.php index cc814d3e04..145076f9d0 100644 --- a/inc/extensions/ext-events.php +++ b/inc/extensions/ext-events.php @@ -77,6 +77,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 76a28076a0..a25a89521c 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -222,6 +222,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-html_mail.php b/inc/extensions/ext-html_mail.php index 39a2bb3988..688ffb9329 100644 --- a/inc/extensions/ext-html_mail.php +++ b/inc/extensions/ext-html_mail.php @@ -130,8 +130,10 @@ case "update": // Update an extension } break; -default: // Do stuff when extension is loaded +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; +default: // Do stuff when extension is loaded // Define all arrary variables as global! global $HTML_TAGS, $URL_ENDS, $VALID_EMAI_CHARS; diff --git a/inc/extensions/ext-iso3166.php b/inc/extensions/ext-iso3166.php index 93beba2e54..4c2cd173ac 100644 --- a/inc/extensions/ext-iso3166.php +++ b/inc/extensions/ext-iso3166.php @@ -327,6 +327,9 @@ VALUES ('AD', 'Andorra', 'ext-iso3166'), } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-mailid.php b/inc/extensions/ext-mailid.php index 0f6d3ec4a0..d9e3367476 100644 --- a/inc/extensions/ext-mailid.php +++ b/inc/extensions/ext-mailid.php @@ -233,6 +233,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-maintenance.php b/inc/extensions/ext-maintenance.php index b1e7c63281..b88d73a90c 100644 --- a/inc/extensions/ext-maintenance.php +++ b/inc/extensions/ext-maintenance.php @@ -104,6 +104,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index b36b18e929..6c7a38913c 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -127,18 +127,19 @@ Bitte stellen Sie diesen derzeit manuell unter = "0.1.1")) - { + if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1")) { // Reset mail order values $result_ext = SQL_QUERY("UPDATE `"._MYSQL_PREFIX."_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__); } diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index 1cd35d4855..4ddeb4b006 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -197,6 +197,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-payout.php b/inc/extensions/ext-payout.php index 9cfc65648c..8c7de0e4e5 100644 --- a/inc/extensions/ext-payout.php +++ b/inc/extensions/ext-payout.php @@ -238,6 +238,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 03b751f904..c7a1124755 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -109,6 +109,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-profile.php b/inc/extensions/ext-profile.php index 9e4854d6c6..75a70b6bc5 100644 --- a/inc/extensions/ext-profile.php +++ b/inc/extensions/ext-profile.php @@ -118,10 +118,12 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Do we have a daily-reset-run? - if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) - { + if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { // So let's check for profiles which needs an update $INC_POOL[] = sprintf("%sinc/profile-updte.php", PATH); } diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index d57fbcc07f..2f12e45136 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -300,6 +300,9 @@ Zudem sollten Sie mindestens folgende Templates (in templates/".GET_LANG } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Do stuff only when not in CSS mode if (($CSS != "1") && ($CSS != "-1") && ($cacheMode != "init")) { @@ -332,15 +335,14 @@ LIMIT 1", __FILE__, __LINE__); FROM "._MYSQL_PREFIX."_rallye_data AS d WHERE d.is_active='Y' AND d.notified='Y' AND d.expired='N' AND (d.end_time <= UNIX_TIMESTAMP()".$OR.") LIMIT 1", __FILE__, __LINE__); - if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE("autopurge"))) - { + if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE("autopurge"))) { // End rallye here... RALLYE_EXPIRE_RALLYES($result); - } + } // END - if // Free memory SQL_FREERESULT($result); - } + } // END - if break; } diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index 0816ffc79f..0d1f452a12 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -100,6 +100,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // When the refback is not installed we cannot load it's configuration... *sigh* break; diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index 474f0a442a..a310f2bca3 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -321,6 +321,9 @@ PRIMARY KEY(id) } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-removeip.php b/inc/extensions/ext-removeip.php index 315194edab..f604231464 100644 --- a/inc/extensions/ext-removeip.php +++ b/inc/extensions/ext-removeip.php @@ -87,6 +87,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-repair.php b/inc/extensions/ext-repair.php index 80cc4a44b4..b5ab379483 100644 --- a/inc/extensions/ext-repair.php +++ b/inc/extensions/ext-repair.php @@ -108,6 +108,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index d3be324c8b..e3b6c75f4d 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -155,6 +155,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Check if mod_rewrite is loadeded if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ diff --git a/inc/extensions/ext-safe.php b/inc/extensions/ext-safe.php index d8b9b855f5..f9859ec4a7 100644 --- a/inc/extensions/ext-safe.php +++ b/inc/extensions/ext-safe.php @@ -77,6 +77,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index 84746d4e1e..22ae5c695b 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -417,6 +417,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 8aa10db56d..a8518ffc07 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -38,13 +38,13 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.5.8"; +$EXT_VERSION = "0.5.9"; // 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"); +$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"); switch ($EXT_LOAD_MODE) { @@ -55,17 +55,15 @@ case "register": // Do stuff when installation is running (modules.php?module=ad case "remove": // Do stuff when removing extension // Drop tables - $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes"; $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las"; $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data"; $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats"; $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_stats_data`"; $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_book`"; + $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`"; // Delete admin menu entries $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE -`what`='theme_import' OR -`what`='theme_edit' OR `what`='config_extensions' OR `what`='config_home' OR `what`='list_unconfirmed' OR @@ -75,15 +73,11 @@ case "remove": // Do stuff when removing extension `what`='config_admin' OR `what`='config_proxy' OR `what`='config_session' OR -LIMIT 13"; - - // Delete guest menu entries - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1"; +`what`='list_filter' +LIMIT 10"; // Delete/update member menu entries $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE -action='themes' OR -`what`='themes' OR `what`='stats2' OR `what`='reflist' OR (action='stats' AND (`what`='' OR what IS NULL)) OR @@ -97,37 +91,37 @@ action='rals' OR action='account'"; // Drop indexes - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY (ext_name)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY (login)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (status)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX (visible)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths DROP UNIQUE KEY (level)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem DROP INDEX (level)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool DROP INDEX (data_type)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg DROP UNIQUE KEY (module)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX (action)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX (what)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (task_type)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (status)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (task_created)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP FULLTEXT (subject)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (subject)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP INDEX (ext_active)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (status)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP FULLTEXT (family)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (max_mails)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (password)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (action)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (what)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (sort)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (visible)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (locked)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (what)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (sort)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (visible)"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (locked)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX (visible)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX (sort)"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY `ext_name`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY `login`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX `visible`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths DROP UNIQUE KEY `level`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem DROP INDEX `level`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool DROP INDEX `data_type`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg DROP UNIQUE KEY `module`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `action`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_type`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `status`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_created`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP FULLTEXT `subject`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `subject`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP INDEX `ext_active`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP FULLTEXT `family`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `max_mails`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `password`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `action`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `sort`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `visible`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `locked`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `sort`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `visible`"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `locked`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `visible`"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `sort`"; break; case "activate": // Do stuff when admin activates this extension @@ -240,24 +234,8 @@ case "update": // Update an extension break; case "0.1.4": // SQL queries for v0.1.4 - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD default_theme VARCHAR(255) NOT NULL DEFAULT '".GET_CURR_THEME()."'"; - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='theme' LIMIT 3"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')"; - $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes"; - $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes ( -id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, -theme_path VARCHAR(255) NOT NULL DEFAULT '', -theme_active ENUM('Y','N') NOT NULL DEFAULT 'N', -theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0', -PRIMARY KEY(id) -) TYPE=MyISAM"; - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Theme-Support integriert. Bitte laden Sie sich zu dieser Version das 281-Patch (wenn Ihr Script v0.2.0-pre7 ist) herunter, da ansonsten die Themes nicht klappen werden!"; + $UPDATE_NOTES = "Ungültiges Update (nach ext-theme.php verschoben!)."; break; case "0.1.5": // SQL queries for v0.1.5 @@ -358,8 +336,6 @@ PRIMARY KEY(id) break; case "0.2.7": // SQL queries for v0.2.7 - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')"; - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'"; $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD stats_limit BIGINT(20) UNSIGNED NOT NULL DEFAULT 10"; $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET `what`='config_stats' WHERE `what`='stats' LIMIT 1"; @@ -396,8 +372,6 @@ PRIMARY KEY(id) case "0.3.1": // SQL queries for v0.3.1 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD UNIQUE KEY (ext_name)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD UNIQUE KEY (theme_path)"; - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD INDEX (theme_active)"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD UNIQUE KEY (login)"; $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (status)"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner ADD INDEX (visible)"; @@ -500,9 +474,7 @@ PRIMARY KEY (id) $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('extras',NULL,'Extras',5,'Y','N')"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('rals',NULL,'Rallyes',6,'Y','N')"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('account',NULL,'Ihr Account',7,'Y','N')"; - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET sort='8' WHERE action='themes' LIMIT 1"; $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='stats', sort='1', title='Klick-Mails' WHERE `what`='stats' LIMIT 1"; - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='account', sort='1', title='Designs' WHERE `what`='themes' LIMIT 1"; $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='extras', sort='3' WHERE `what`='reflinks' LIMIT 1"; // Update notes (these will be set as task text!) @@ -715,9 +687,27 @@ INDEX (`stats_type`) // Update notes (these will be set as task text!) $UPDATE_NOTES = "Sprachdateinamen werden nicht mehr in der Datenbank behalten."; break; + + case "0.5.9": // SQL queries for v0.5.9 + $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`"; + $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_filters` ( +`filter_id` BIGINT(20) UNSIGNED AUTO_INCREMENT, +`filter_name` VARCHAR(255) NOT NULL DEFAULT '', +`filter_function` VARCHAR(255) NOT NULL DEFAULT '', +`filter_active` ENUM('N','Y') NOT NULL DEFAULT 'Y', +PRIMARY KEY (`filter_id`) +) TYPE=MyISAM COMMENT='Filter system'"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','list_filter','Filter-Management', 'Zeigt alle im System registrierten Filter an und lässt diese de- bzw. wieder aktivieren.', 17)"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Tabellen für Filter-System hinzugefügt."; + break; } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // When the sql_patches is not installed we cannot load it's configuration... *sigh* if (GET_EXT_VERSION("sql_patches") != '') { diff --git a/inc/extensions/ext-support.php b/inc/extensions/ext-support.php index 2c5de7e81b..fe9b03ee45 100644 --- a/inc/extensions/ext-support.php +++ b/inc/extensions/ext-support.php @@ -125,6 +125,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 8c091b9b19..fbb2cf5068 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -227,6 +227,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // Set some constants we need??? define('edit', "edit"); diff --git a/inc/extensions/ext-task.php b/inc/extensions/ext-task.php index ca2829f6b5..c03ef7ac2f 100644 --- a/inc/extensions/ext-task.php +++ b/inc/extensions/ext-task.php @@ -240,6 +240,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-theme.php b/inc/extensions/ext-theme.php index 7876bc5860..39d74b135d 100644 --- a/inc/extensions/ext-theme.php +++ b/inc/extensions/ext-theme.php @@ -38,24 +38,32 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.0.7"; +$EXT_VERSION = "0.0.8"; // Auto-set extension version if (empty($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"); +$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"); switch ($EXT_LOAD_MODE) { case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) // SQL commands to run - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)"; break; case "remove": // Do stuff when removing extension - // SQL commands to run - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='theme_check' LIMIT 1"; + // Drop theme table + $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes"; + + // Delete admin menu + $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `action`='theme' LIMIT 4"; + + // Delete guest menu entries + $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1"; + + // Delete/update member menu entries + $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE action='themes' OR `what`='themes' LIMIT 2"; break; case "activate": // Do stuff when admin activates this extension @@ -107,9 +115,47 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Designname (von Menschen lesbar) hinzugefügt."; break; + + case "0.0.8": // SQL queries for v0.0.8 + // Theme table + $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes"; + $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes ( +id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +theme_path VARCHAR(255) NOT NULL DEFAULT '', +theme_active ENUM('Y','N') NOT NULL DEFAULT 'N', +theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0', +PRIMARY KEY(`id`), +UNIQUE KEY(`theme_path`), +INDEX(`theme_active`), +) TYPE=MyISAM"; + + // Admin menu + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)"; + + // Guest menu + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')"; + + // Memember menu + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET sort='8' WHERE action='themes' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='account', sort='1', title='Designs' WHERE `what`='themes' LIMIT 1"; + + // User data + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Update von sql_patches übertragen. (Kann Fehlermeldungen verursacht haben!)"; + break; } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-top10.php b/inc/extensions/ext-top10.php index 5156f6dc02..92ad4d70c8 100644 --- a/inc/extensions/ext-top10.php +++ b/inc/extensions/ext-top10.php @@ -139,6 +139,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index 15748a8cbc..a807ee29e3 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -276,6 +276,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['ap_transfer'] == "Y")) { // Automatically remove outdated or not displayed transactions diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index f6a258c964..08c607e544 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -246,6 +246,9 @@ PRIMARY KEY(`id`) } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded break; } diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index bce881bd18..d8d32222ff 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -133,13 +133,15 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded + // Init array + global $WERNIS; + $WERNIS = array(); break; } -// Init array -global $WERNIS; -$WERNIS = array(); - // ?> diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 4fad3694a8..ec21cec859 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -108,6 +108,9 @@ case "update": // Update an extension } break; +case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. + break; + default: // Do stuff when extension is loaded // The translation table $yoomediaTranslationTable = array( diff --git a/inc/filters.php b/inc/filters.php new file mode 100644 index 0000000000..33c59228a0 --- /dev/null +++ b/inc/filters.php @@ -0,0 +1,250 @@ + array(), + // Filters for post-init phase + 'postinit' => array(), + // Filters for shutdown phase + 'shutdown' => array() + ); + + // Init loaded filters + $loadedFilters = array(); + + // Load all saved filers if sql_patches is updated + if (GET_EXT_VERSION("sql_patches") >= "0.5.9") { + // Load all active filers + $result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active` +FROM `"._MYSQL_PREFIX."_filters` +ORDER BY `filter_id` ASC", __FILE__, __LINE__); + + // Are there entries? + if (SQL_NUMROWS($result) > 0) { + // Load all filters + while ($filterArray = SQL_FETCHARRAY($result)) { + // Mark this filter as loaded (from database) + $loadedFilters[$filterArray['filter_name']][$filterArray['filter_function']] = true; + + // Set this filter + $filters[$filterArray['filter_name']][$filterArray['filter_function']] = $filterArray['filter_active']; + } // END - while + } // END - if + + // Free result + SQL_FREERESULT($result); + } // END - if + + // @TODO Find some more init/shutdown filter functions + + // Register shutdown filters + REGISTER_FILTER('shutdown', 'FLUSH_FILTERS'); + REGISTER_FILTER('shutdown', 'SHUTDOWN_DATABASE'); +} + +// "Registers" a new filter function +function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) { + global $filters; + + // Extend the filter function name + $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction)); + + // Is that filter already there? + if (isset($filters[$filterName][$filterFunction])) { + // Then abort here + if (!$silentAbort) { + ADD_FATAL(sprintf(FILTER_FAILED_ALREADY_ADDED, $filterFunction, $filterName)); + } // END - if + + // Abort here + return false; + } // END - if + + // Is the function there? + if (!function_exists($filterFunction)) { + // Then abort here + ADD_FATAL(sprintf(FILTER_FAILED_NOT_FOUND, $filterFunction, $filterName)); + return false; + } // END - if + + // Simply add it to the array + $filters[$filterName][$filterFunction] = "Y"; +} + +// "Unregisters" a filter from the given chain +function UNREGISTER_FILTER ($filterName, $filterFunction) { + global $filters; + + // Is that filter there? + if (!isset($filters[$filterName][$filterFunction])) { + // Not found, so abort here + ADD_FATAL(sprintf(FILTER_FAILED_NOT_REMOVED, $filterFunction, $filterName)); + return false; + } // END - if + + // Mark for filter removal + $filters[$filterName][$filterFunction] = "R"; +} + +// "Runs" the given filters, data is optional and can be any type of data +function RUN_FILTER ($filterName, $data = null, $silentAbort = true) { + global $filters; + + // Is that filter chain there? + if (!isset($filters[$filterName])) { + // Then abort here (quick'N'dirty hack) + if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) { + ADD_FATAL(sprintf(FILTER_FAILED_NO_FILTER_FOUND, $filterName)); + } // END - if + + // Abort here + return false; + } // END - if + + // Default return value + $returnValue = $data; + + // Then run all filters + foreach ($filters[$filterName] as $filterFunction=>$active) { + // Debug message + /* DEBUG: */ echo __FUNCTION__."(".__LINE__."): name={$filterName}, func={$filterFunction}, active={$active}
\n"; + + // Is the filter active? + if ($active == "Y") { + // Call the filter chain + $returnValue = call_user_func_array($filterFunction, array($returnValue)); + } // END - if + } // END - foreach + + // Return the filtered content + return $returnValue; +} + +// ----------------------------------------------------------------------------- +// Generic filter functions we always need +// ----------------------------------------------------------------------------- + +// Filter for flushing all new filters to the database +function FILTER_FLUSH_FILTERS () { + global $filters, $link, $loadedFilters; + + // Is a database link here and not in installation mode? + if ((!is_resource($link)) && (!isBooleanConstantAndTrue('mxchange_installing'))) { + // Abort here + ADD_FATAL(sprintf(FILTER_FLUSH_FAILED_NO_DATABASE, $filterFunction, $filterName)); + return false; + } // END - if + + // Is the extension sql_patches updated? + if (EXT_VERSION_IS_OLDER("sql_patches", "0.5.9")) { + // Abort silently here + return false; + } // END - if + + // Nothing is added/remove by default + $inserted = 0; $removed = 0; + + // Prepare SQL queries + $insertSQL = "INSERT INTO `"._MYSQL_PREFIX."_filters` (`filter_name`,`filter_function`,`filter_active`) VALUES"; + $removeSQL = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_filters` WHERE"; + + // Write all filters to database + foreach ($filters as $filterName => $filterArray) { + // Walk through all filters + foreach ($filterArray as $filterFunction => $active) { + // Is this filter loaded? + if (!isset($loadedFilters[$filterName][$filterFunction])) { + // Add this filter (all filters are active by default) + $insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction); + $inserted++; + } elseif ($active == "R") { + // Remove this filter + $removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction); + $removed++; + } + } // END - foreach + } // END - foreach + + // Something has been added? + if ($inserted > 0) { + // Finish SQL command + $insertSQL = substr($insertSQL, 0, -1); + + // And run it + SQL_QUERY($insertSQL, __FILE__, __LINE__); + } // END - if + + // Something has been removed? + if ($removed > 0) { + // Finish SQL command + $removeSQL = substr($removeSQL, 0, -2) . "LIMIT ".$removed; + + // And run it + SQL_QUERY($removeSQL, __FILE__, __LINE__); + } // END - if +} + +// Filter for shutting down the database link +function FILTER_SHUTDOWN_DATABASE () { + global $link; + + if (is_resource($link)) { + // Close link + SQL_CLOSE($link, __FILE__, __LINE__); + } else { + // No database link + ADD_FATAL(NO_DB_LINK); + } +} + +// +?> diff --git a/inc/footer.php b/inc/footer.php index c911ac5554..90f323b5c3 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -73,27 +73,13 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) { // And the last closing HTML tag OUTPUT_HTML(""); +} // END - if - // Footer has been reached - $footer = 1; - - // Output HTML code - OUTPUT_HTML(""); - - if (is_resource($link)) { - // Close link - SQL_CLOSE($link, __FILE__, __LINE__); - } else { - // No database link - ADD_FATAL(NO_DB_LINK); - } -} elseif ($CSS == "1") { - // Footer has been reached - $footer = 1; +// Footer has been reached +$footer = 1; - // Output CSS content - OUTPUT_HTML(""); -} +// Output HTML code +OUTPUT_HTML(""); // ?> diff --git a/inc/functions.php b/inc/functions.php index de061a52f2..4b87bcf918 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Check if our config file is writeable or not -function is_INCWritable($inc) { +function IS_INC_WRITEABLE($inc) { // Generate FQFN $fqfn = sprintf("%sinc/%s.php", PATH, $inc); @@ -802,8 +802,9 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { } // END - if // Load user's data - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):UID={$UID},template={$template}
\n"; - if ($UID > 0) { + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):UID={$UID},template={$template},content[]=".gettype($content)."
\n"; + if (($UID > 0) && (is_array($content))) { + // If nickname extension is installed, fetch nickname as well if (EXT_IS_ACTIVE("nickname")) { //* DEBUG: */ print __FUNCTION__."(".__LINE__."):NICKNAME!
\n"; // Load nickname @@ -816,14 +817,10 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { array(bigintval($UID)), __FILE__, __LINE__); } - // Is content an array? - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):content[]=".gettype($content)."
\n"; - if (is_array($content)) { - // Fetch and migrate data - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):content()=".count($content)." - PRE
\n"; - $content = array_merge($content, SQL_FETCHARRAY($result)); - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):content()=".count($content)." - AFTER
\n"; - } // END - if + // Fetch and merge data + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):content()=".count($content)." - PRE
\n"; + $content = array_merge($content, SQL_FETCHARRAY($result)); + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):content()=".count($content)." - AFTER
\n"; // Free result SQL_FREERESULT($result); @@ -833,7 +830,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { if (isset($content['gender'])) $content['gender'] = TRANSLATE_GENDER($content['gender']); // Overwrite email from data if present - if (isset($content['email'])) $email = $content['email']; + if (isset($content['email'])) $email = $content['email']; // Store email for some functions in global data array $DATA['email'] = $email; @@ -2415,7 +2412,7 @@ function DEBUG_LOG ($file, $line, $message, $force=true) { if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) { // Log this message away $fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!"); - fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename(__FILE__)."|".__LINE__."|".strip_tags($message)."\n"); + fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($file)."|".$line."|".strip_tags($message)."\n"); fclose($fp); } // END - if } @@ -2815,15 +2812,18 @@ function DETERMINE_REFID () { // Set cookie set_session('refid', $GLOBALS['refid']); } // END - if + + // Return determined refid + return $GLOBALS['refid']; } // Destroys the admin session function DESTROY_ADMIN_SESSION () { // Kill maybe existing session variables including array elements - set_session('admin_login' , ""); - set_session('admin_md5' , ""); - set_session('admin_last' , ""); - set_session('admin_to' , ""); + set_session('admin_login', ""); + set_session('admin_md5' , ""); + set_session('admin_last' , ""); + set_session('admin_to' , ""); // Destroy session and return status return @session_destroy(); @@ -2843,7 +2843,7 @@ function IF_APACHE_MODULE_LOADED ($apacheModule) { // if (!function_exists('html_entity_decode')) { // Taken from documentation on www.php.net - function html_entity_decode($string) { + function html_entity_decode ($string) { $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); diff --git a/inc/install-inc.php b/inc/install-inc.php index 7c3860c9e3..b01597a871 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -398,9 +398,6 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT install_WriteData($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0); install_WriteData($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0); install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0); - - // Close the link - SQL_CLOSE($link, __FILE__, __LINE__); } else { // Installation area not found! ADD_FATAL(INSTALL_MISSING_DUMPS); diff --git a/inc/language/de.php b/inc/language/de.php index cdede86176..3de3caa6e4 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1194,6 +1194,7 @@ define('MOD_REWRITE_ERROR', "Sie müssen mod_rewrite in Apache aktiviert hab define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler"); define('TASK_SUBJ_EXTENSION_DEACTIVATED', "Erweiterung deaktiviert"); define('ADMIN_SUBJECT_EXTENSION_DEACTIVATED', "Automatische Deaktivierung einer Erweiterung"); +define('FATAL_EXTENSION_LOADED', "Erweiterung %s/u> bereits geladen!"); define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail %s bestätigt."); define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail %s bestätigt."); @@ -1233,5 +1234,13 @@ define('ADMIN_TASK_IS_EXTENSION', "Erweiterung-Management"); define('ADMIN_TASK_IS_EXTENSION_UPDATE', "Erweiterung-Update"); define('ADMIN_TASK_IS_EXTENSION_DEACTIVATION', "Erweiterung-Management"); +// Filter sub-system +define('FILTER_FAILED_ALREADY_INIT', "Filter-System ist bereits initialisiert."); +define('FILTER_FAILED_ALREADY_ADDED', "Die Filterfunktion %s ist bereits der Filterkette %s hinzugefügt."); +define('FILTER_FAILED_NOT_FOUND', "Die Filterfunktion %s wurde nicht gefunden und konnte der Filterkette %s nicht hinzugefügt werden."); +define('FILTER_FAILED_NO_FILTER_FOUND', "Die Filterkette %s konnte nicht gefunden werden."); +define('FILTER_FAILED_NOT_REMOVED', "Die Filterfunktion %s konnte nicht aus der Filterkette %s entfernt werden, da sie nicht existiert."); +define('FILTER_FLUSH_FAILED_NO_DATABASE', "Kann die Filterketten nicht speichern. Datenbank fehlt!"); + // ?> diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index f0cdd7536b..48cff14598 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -254,9 +254,7 @@ WHERE id=%s LIMIT 1", } // Remove cache file - if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) { - if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile(); - } + RUN_FILTER('post_admin_edited', $_POST); } // Make admin accounts editable @@ -367,9 +365,7 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) { } // Remove cache if cache system is activated - if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) { - if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile(); - } + RUN_FILTER('post_admin_deleted', $_POST); } // List all admin accounts diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index bb24447efd..1004594d62 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -378,5 +378,28 @@ class CacheSystem { return $this->ret; } } + +// Destroy the cache on extension changes +function FILTER_CACHE_DESTROY_ON_EXT_CHANGE () { + global $cacheInstance; + + // Update cache + if (EXT_IS_ACTIVE("cache")) { + if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile(); + if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile(); + if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); + } // END - if +} + +// Destroy the cache on changing admin +function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () { + global $cacheInstance; + + // Update cache + if (EXT_IS_ACTIVE("cache")) { + if ($cacheInstance->loadCacheFile("admin")) $cacheInstance->destroyCacheFile(); + } // END - if +} + // ?> diff --git a/inc/libs/country_functions.php b/inc/libs/country_functions.php index 6f31bb5102..8b879e251c 100644 --- a/inc/libs/country_functions.php +++ b/inc/libs/country_functions.php @@ -37,23 +37,27 @@ if (!defined('__SECURITY')) { require($INC); } -// -function COUNTRY_GENERATE_INFO($ID) -{ +// Generate a human-readable country description with code +function COUNTRY_GENERATE_INFO ($id) { + // Load code and description $result = SQL_QUERY_ESC("SELECT code, descr FROM "._MYSQL_PREFIX."_countries WHERE id=%s LIMIT 1", - array(bigintval($ID)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($id)), __FILE__, __LINE__); + + // Is there an entry? + if (SQL_NUMROWS($result) == 1) { + // Load entry list($code, $descr) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - $ret = $descr." (".$code.")"; - } - else - { + + // Construct human-readable description + $ret = sprintf("%s (%s)", $descr, $code); + } else { // Not found! $ret = COUNTRY_NOT_FOUND; } + // Free the result + SQL_FREERESULT($result); + // Return info return $ret; } diff --git a/inc/libs/events_functions.php b/inc/libs/events_functions.php new file mode 100644 index 0000000000..4d3be82dfa --- /dev/null +++ b/inc/libs/events_functions.php @@ -0,0 +1,41 @@ + diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index 4c99be29ab..978b87ba5a 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -139,7 +139,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) // // Solved tasks // - $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_ADMIN_ID(get_session('admin_login')))); + $value = GET_TOTAL_DATA("CLOSED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_ADMIN_ID(get_session('admin_login')))); if ($value > 0) { define('__TASK_SOLVED_VALUE', "".$value.""); diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php new file mode 100644 index 0000000000..5adb09e7df --- /dev/null +++ b/inc/libs/theme_functions.php @@ -0,0 +1,312 @@ += "0.1.4")) { + //die("
".print_r($cacheArray['themes'], true)."
"); + // Get theme from cookie + $ret = get_session('mxchange_theme'); + + // Is it valid? + if (THEME_GET_ID($ret) == 0) { + // Fix it to default + $ret = "default"; + } // END - if + } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) { + // Prepare FQFN for checking + $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_GET['theme'])); + + // Installation mode active + if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) { + // Set cookie from URL data + set_session("mxchange_theme", $_GET['theme']); + } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) { + // Set cookie from posted data + set_session("mxchange_theme", $_POST['theme']); + } + + // Set return value + $ret = get_session('mxchange_theme'); + } else { + // Invalid design, reset cookie + set_session("mxchange_theme", $ret); + } + + // Add (maybe) found theme.php file to inclusion list + $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret)); + + // Try to load the requested include file + if (FILE_READABLE($theme)) $INC_POOL[] = $theme; + + // Return theme value + return $ret; +} + +function THEME_SELECTION_BOX($mod, $act, $wht, $result) { + // Construction URL + $FORM = URL."/modules.php?module=".$mod; + if (!empty($act)) $FORM .= "&action=".$act; + if (!empty($wht)) $FORM .= "&what=".$wht; + define('__FORM_VALUE', $FORM); + + // Initialize array + $THEMES = array( + 'theme_unix' => array(), // Unix name from filesystem + 'theme_name' => array() // Title + ); + + // Load all themes + while(list($theme) = SQL_FETCHROW($result)) { + // Load it's theme.php file + $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme)); + if (FILE_READABLE($INC)) { + // And save all data in array + require($INC); + $THEMES['theme_unix'][] = $theme; + $THEMES['theme_name'][] = $THEME_NAME; + } // END - if + } // END - while + + // Sort whole array by title + array_pk_sort($THEMES, array("theme_name")); + + // Construct selection form for the box template + $OUT = ""; + foreach ($THEMES['theme_unix'] as $key => $theme) { + $OUT .= "