]> git.mxchange.org Git - mailer.git/commitdiff
Several fixes for extension handling
authorRoland Häder <roland@mxchange.org>
Tue, 16 Dec 2008 21:14:54 +0000 (21:14 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 16 Dec 2008 21:14:54 +0000 (21:14 +0000)
13 files changed:
inc/databases.php
inc/db/lib.php
inc/extensions/ext-cache.php
inc/extensions/ext-theme.php
inc/filters.php
inc/libs/task_functions.php
inc/libs/theme_functions.php
inc/loader/load_cache-them.php
inc/modules/admin/what-theme_edit.php
inc/modules/guest/action-themes.php
inc/modules/member/action-themes.php
inc/mysql-connect.php
inc/stylesheet.php

index ba9e76ec5baa19d9c2b6f0d64c25b36813846794..39abdceaec49c4d92b055f52a5ca3b5729dd0d02 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "636");
+define('CURR_SVN_REVISION', "637");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 7578d6077012f93178cb010603cf24948f56ea63..4384bfea813a58fa0e813a765fa08055e6f6d573 100644 (file)
@@ -51,5 +51,8 @@ if ((file_exists($INC)) && (is_readable($INC))) {
        die("Cannot load database abstraction layer! R.I.P.");
 }
 
+// Remove this globally used variable
+unset($INC);
+
 //
 ?>
index 867bf66a1b44576a2561c8123904a6caad8722e0..d55b2afb552ec3df5997f53e0453c0e9f5e41306 100644 (file)
@@ -62,13 +62,13 @@ case "remove": // Do stuff when removing extension
        $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('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+       UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+       UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+       UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
        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');
+       UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
+       UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
        break;
 
 case "activate": // Do stuff when admin activates this extension
@@ -211,13 +211,13 @@ case "update": // Update an extension
 
        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');
+               REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+               REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+               REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+               REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+               REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+               REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+               REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Filter hinzugef&uuml;gt f&uuml;r Erweiterungsmanagement.";
index 39d74b135dec01880b6a72f9841ddeff6bce7d9f..1a95e558eff0b59115d55421216d690d6f3852d8 100644 (file)
@@ -54,7 +54,7 @@ case "register": // Do stuff when installation is running (modules.php?module=ad
 
 case "remove": // Do stuff when removing extension
        // Drop theme table
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
+       $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";
@@ -62,7 +62,7 @@ case "remove": // Do stuff when removing extension
        // Delete guest menu entries
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1";
 
-       // Delete/update member menu entries
+       // Delete member menu entries
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE action='themes' OR `what`='themes' LIMIT 2";
        break;
 
@@ -110,24 +110,23 @@ case "update": // Update an extension
                break;
 
        case "0.0.7": // SQL queries for v0.0.7
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD theme_name VARCHAR(255) NOT NULL DEFAULT ''";
-
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Designname (von Menschen lesbar) hinzugef&uuml;gt.";
+               $UPDATE_NOTES = "Ung&uuml;ltiges Update.";
                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 (
+               $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_name 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";
+PRIMARY KEY (`id`),
+UNIQUE KEY (`theme_path`),
+INDEX (`theme_active`)
+) TYPE=MyISAM COMMENT='Themes'";
 
                // 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)";
index 33c59228a02b7cc2329c13c3870f2834ee053ee9..b750c4a772aed5fe03084462a730e27ff7d63e42 100644 (file)
@@ -92,14 +92,14 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
 }
 
 // "Registers" a new filter function
-function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false) {
        global $filters;
 
        // Extend the filter function name
        $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
 
        // Is that filter already there?
-       if (isset($filters[$filterName][$filterFunction])) {
+       if ((isset($filters[$filterName][$filterFunction])) && (!$force)) {
                // Then abort here
                if (!$silentAbort) {
                        ADD_FATAL(sprintf(FILTER_FAILED_ALREADY_ADDED, $filterFunction, $filterName));
@@ -121,11 +121,14 @@ function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
 }
 
 // "Unregisters" a filter from the given chain
-function UNREGISTER_FILTER ($filterName, $filterFunction) {
+function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false) {
        global $filters;
 
+       // Extend the filter function name
+       $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
+
        // Is that filter there?
-       if (!isset($filters[$filterName][$filterFunction])) {
+       if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) {
                // Not found, so abort here
                ADD_FATAL(sprintf(FILTER_FAILED_NOT_REMOVED, $filterFunction, $filterName));
                return false;
index 978b87ba5a19a49fddfadfcaab28fde1fe1ccc9e..76d794d9cc2371d4946473f897d1d650101177b6 100644 (file)
@@ -485,13 +485,13 @@ ORDER BY beg_points DESC, userid";
 
        if (EXT_IS_ACTIVE("theme")) {
                // List all themes
-               $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_themes ORDER BY id";
+               $SQLs[]   = "SELECT id FROM `"._MYSQL_PREFIX."_themes` ORDER BY id";
                $WHATs[]  = "theme_edit";
                $DESCRs[] = TASK_ADMIN_LIST_THEME_ALL;
                $TITLEs[] = TASK_ADMIN_LIST_THEME_ALL_TITLE;
 
                // List active themes
-               $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_active='Y' ORDER BY id";
+               $SQLs[]   = "SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_active='Y' ORDER BY id";
                $WHATs[]  = "theme_edit";
                $DESCRs[] = TASK_ADMIN_LIST_THEME_ACTIVE;
                $TITLEs[] = TASK_ADMIN_LIST_THEME_ACTIVE_TITLE;
index 5adb09e7df41bbfae32fe1627f7b4594252291a4..6fbcd9890409a194c3cdb3d73a69e7a9decbfb84 100644 (file)
@@ -157,7 +157,7 @@ function THEME_GET_VERSION ($name) {
                if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Load version from database
-               $result = SQL_QUERY_ESC("SELECT theme_ver FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT theme_ver FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
                        array($name), __FILE__, __LINE__);
 
                // Entry found?
@@ -196,7 +196,7 @@ function THEME_GET_ID ($name) {
                if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
                        array($name), __FILE__, __LINE__);
 
                // Entry found?
@@ -241,7 +241,7 @@ function THEME_IS_ACTIVE ($name) {
                if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT theme_active FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT theme_active FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
                        array($name), __FILE__, __LINE__);
 
                // Is the theme active and installed?
@@ -277,7 +277,7 @@ function GET_CURR_THEME_NAME () {
                if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT theme_name FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
                        array($name), __FILE__, __LINE__);
 
                // Load theme name
index a92039fe182aa3186aa097b89d235f5813483024..9f09a159f443921929949bb0ee916f53682dfa53 100644 (file)
@@ -69,9 +69,9 @@ if (($cacheInstance->loadCacheFile("themes")) && ($cacheInstance->extensionVersi
 
        // Load all themes and their data
        if (GET_EXT_VERSION("theme") >= "0.0.7") {
-               $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM "._MYSQL_PREFIX."_themes ORDER BY id", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `"._MYSQL_PREFIX."_themes` ORDER BY id", __FILE__, __LINE__);
        } else {
-               $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver FROM "._MYSQL_PREFIX."_themes ORDER BY id", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver FROM `"._MYSQL_PREFIX."_themes` ORDER BY id", __FILE__, __LINE__);
        }
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
index 7a9024674ed0e38d04001c8d3bc7017d94dee896..f5de9a864ada2ef6d384912d9b00abcc6cb8eb1c 100644 (file)
@@ -54,14 +54,14 @@ if ($SEL > 0) {
                if (isset($_POST['status'])) {
                        // Change status
                        if ($_POST['active'][$id] == "Y") {
-                               $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='N' WHERE id='".$id."' LIMIT 1";
+                               $SQL = "UPDATE `"._MYSQL_PREFIX."_themes` SET theme_active='N' WHERE id='".$id."' LIMIT 1";
                        } else {
-                               $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
+                               $SQL = "UPDATE `"._MYSQL_PREFIX."_themes` SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
                        }
                        $OUT = ADMIN_THEMES_UPDATED;
                } elseif (isset($_POST['del'])) {
                        // Delete themes
-                       $SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_themes WHERE id='".$id."' LIMIT 1";
+                       $SQL = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_themes` WHERE id='".$id."' LIMIT 1";
                        $OUT = ADMIN_THEMES_DELETED;
                }
 
@@ -98,7 +98,7 @@ $THEME_MODE = "test";
 
 // Generate output lines for the template
 $OUT = ""; $SW = 2;
-$result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM "._MYSQL_PREFIX."_themes ORDER BY theme_path", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `"._MYSQL_PREFIX."_themes` ORDER BY theme_path", __FILE__, __LINE__);
 if (SQL_NUMROWS($result) > 0)
 {
        while(list($id, $unix, $active, $ver, $name) = SQL_FETCHROW($result))
index e0b248c952bb3664cd04d1036d086c068714c3ad..8bbac22d4670fc25baf0019ff46c75f88da05ea0 100644 (file)
@@ -46,7 +46,7 @@ if (defined('__THEME_SELECTION_CONTENT')) return false;
 // Load all active designs (or all if admin)
 $whereStatement = ""; $OUT = "";
 if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
-$result_themes = SQL_QUERY("SELECT theme_path FROM "._MYSQL_PREFIX."_themes".$whereStatement, __FILE__, __LINE__);
+$result_themes = SQL_QUERY("SELECT theme_path FROM `"._MYSQL_PREFIX."_themes`".$whereStatement, __FILE__, __LINE__);
 $num_themes = SQL_NUMROWS($result_themes);
 
 if ($num_themes > 1) {
index 3b395570bb128db8c291713bce224d9f86ecc2b4..c06b4d9b2193d1c7d9f1336f9654c43044e1e91a 100644 (file)
@@ -48,7 +48,7 @@ if (defined('__THEME_SELECTION_CONTENT')) return false;
 // Load all active designs (or all if admin)
 $whereStatement = ""; $OUT = "";
 if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
-$result_themes = SQL_QUERY("SELECT theme_path FROM "._MYSQL_PREFIX."_themes".$whereStatement, __FILE__, __LINE__);
+$result_themes = SQL_QUERY("SELECT theme_path FROM `"._MYSQL_PREFIX."_themes`".$whereStatement, __FILE__, __LINE__);
 $num_themes = SQL_NUMROWS($result_themes);
 
 if ($num_themes > 1) {
index f52848abc04bb0db01758ac92c0ba85d5d5511af..b81ae597f62e482c69b7ed412897fc4c43cd545f 100644 (file)
@@ -151,6 +151,12 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                // Run daily reset
                                require_once(PATH."inc/check-reset.php");
 
+                               // Create missing configuration file
+                               if (!function_exists('GET_CURR_THEME')) {
+                                       // Load dummy theme functions
+                                       require_once(PATH."inc/theme-dummy.php");
+                               } // END - if
+
                                // Load admin include file if he is admin
                                if (IS_ADMIN()) {
                                        // Administrative functions
@@ -255,6 +261,12 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        require_once(PATH."inc/databases.php");
        require_once(PATH."inc/session.php");
 
+       // Create missing configuration file
+       if (!function_exists('GET_CURR_THEME')) {
+               // Load dummy theme functions
+               require_once(PATH."inc/theme-dummy.php");
+       } // END - if
+
        // Check if we are in installation routine
        $installPhp = basename($_SERVER['PHP_SELF']);
        if (($installPhp != "install.php") && ($CSS != "1") && ($CSS != -1)) {
index 4d7c214aaff4ab4a87f267a738130a9994816cf0..a8e5748a83fa29127d9805fc3daab90587863f85 100644 (file)
@@ -56,12 +56,6 @@ if (($CSS == "1") || ($_CONFIG['css_php'] == "DIRECT")) {
                foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
        } // END - if
 
-       // Create missing configuration file
-       if (!function_exists('GET_CURR_THEME')) {
-               // Load dummy theme functions
-               require_once(PATH."inc/theme-dummy.php");
-       } // END - if
-
        // Output inclusion lines
        foreach ($STYLES as $value) {
                // Only include found CSS files (to reduce 404 requests)