]> git.mxchange.org Git - mailer.git/commitdiff
Heavily rewritten API:
authorRoland Häder <roland@mxchange.org>
Tue, 16 Dec 2008 20:32:42 +0000 (20:32 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 16 Dec 2008 20:32:42 +0000 (20:32 +0000)
- 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

78 files changed:
.gitattributes
beg.php
inc/autopurge.php
inc/databases.php
inc/extensions.php
inc/extensions/ext-
inc/extensions/ext-active.php
inc/extensions/ext-admins.php
inc/extensions/ext-admintheme1.php
inc/extensions/ext-admintheme_default.php
inc/extensions/ext-autopurge.php
inc/extensions/ext-bank.php
inc/extensions/ext-beg.php
inc/extensions/ext-birthday.php
inc/extensions/ext-bonus.php
inc/extensions/ext-booking.php
inc/extensions/ext-cache.php
inc/extensions/ext-country.php
inc/extensions/ext-debug.php
inc/extensions/ext-demo.php
inc/extensions/ext-doubler.php
inc/extensions/ext-events.php
inc/extensions/ext-holiday.php
inc/extensions/ext-html_mail.php
inc/extensions/ext-iso3166.php
inc/extensions/ext-mailid.php
inc/extensions/ext-maintenance.php
inc/extensions/ext-mediadata.php
inc/extensions/ext-mods.php
inc/extensions/ext-mydata.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-nickname.php
inc/extensions/ext-online.php
inc/extensions/ext-optimize.php
inc/extensions/ext-order.php
inc/extensions/ext-other.php
inc/extensions/ext-payout.php
inc/extensions/ext-primera.php
inc/extensions/ext-profile.php
inc/extensions/ext-rallye.php
inc/extensions/ext-refback.php
inc/extensions/ext-register.php
inc/extensions/ext-removeip.php
inc/extensions/ext-repair.php
inc/extensions/ext-rewrite.php
inc/extensions/ext-safe.php
inc/extensions/ext-sponsor.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-support.php
inc/extensions/ext-surfbar.php
inc/extensions/ext-task.php
inc/extensions/ext-theme.php
inc/extensions/ext-top10.php
inc/extensions/ext-transfer.php
inc/extensions/ext-user.php
inc/extensions/ext-wernis.php
inc/extensions/ext-yoomedia.php
inc/filters.php [new file with mode: 0644]
inc/footer.php
inc/functions.php
inc/install-inc.php
inc/language/de.php
inc/libs/admins_functions.php
inc/libs/cache_functions.php
inc/libs/country_functions.php
inc/libs/events_functions.php [new file with mode: 0644]
inc/libs/task_functions.php
inc/libs/theme_functions.php [new file with mode: 0644]
inc/load_extensions.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-admins_add.php
inc/modules/admin/what-extensions.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/stylesheet.php
inc/theme-dummy.php [new file with mode: 0644]
inc/theme-manager.php

index 7e7e3213b671d1fd4cad5d145cc36ade5bb3795a..160df8a5fa4c8f3903657a33302db7c42fceb2b0 100644 (file)
@@ -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 4b2a5d5f6bae8de0f269e498e911cf4cd49b0bfa..440e7328da880ef310b9f4ff119ae9237adf97bf 100644 (file)
--- 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);
 
index ee4ec0224aaf1a6ff562f40e63ddbe17d162325c..15e1832d90e0b7b20f9992ecf6cf887da4ddd377 100644 (file)
@@ -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
 
 //
 ?>
index cb134ee8b35b1114423bdd014524003617b31b9d..bfae15619835f7dbefcf0d4e9529e7ae66c7276e 100644 (file)
@@ -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);
index 68f89a1954b3e8689e59ace083a41de4d71f5117..2906fbf58aaee47e0e2cce0a31107e34a04d5c98 100644 (file)
@@ -43,11 +43,11 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "") {
 
        // Is the extension already loaded?
        //* DEBUG: */ echo "Loading extension {$ext_name}.<br />\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!<br />\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!<br />\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  = "<DIV align=\"center\">
-<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$WIDTH."\" align=\"center\"".$dashed.">
+<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$width."\" align=\"center\"".$dashed.">
 <TR>
   <TD colspan=\"2\" align=\"center\" class=\"admin_title bottom2\" height=\"24\">
     <STRONG>".$title.":</STRONG>
@@ -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);
        }
index 668e7b87c6c4b8845edce87d0bb675b3bfef8885..1fefa3bf0c0d4efc203b0dafc7a361432c51f568 100644 (file)
@@ -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;
 }
index c41232f6def3807222e4d937f99e19553532b844..b357a96a526fe24c5868c2029c966be6bac125a6 100644 (file)
@@ -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;
 }
index 2e3777df55f8f6d1efb550148a7cdb82fda82379..d103d13c3467ca376f71f1b48cf431a205b11f51 100644 (file)
@@ -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;
 }
index 9bd5fa88b8e8d5601c72deb2d5cec1d7d3ca0e0a..72b2300050334c1d8ad45ce4aec2fb82e777a8fe 100644 (file)
@@ -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;
 }
index 24f36015cee2725925ecb79f68382103d2703411..5934c04fd14d35f307a3c0b2cc71fa4e224fc938 100644 (file)
@@ -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;
 }
index c549e7c8e948711b928af2ec610c810c15f0f41c..eaae7a41779aaa2aa400dd6745db78fb5a8fb613 100644 (file)
@@ -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))
index 1505c5c2de69bf7666b9106ad4bba42b859ac032..e3af3054a9616e535c12b7cfc703792ff1a222cb 100644 (file)
@@ -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;
 }
index fd553900a12be556081eeca34089ce146d5694c9..d096f171414c9b2fbe77a182f1e4c893e6ff1134 100644 (file)
@@ -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'];
index 0217d46461ce9c16e17f45501aaada28b140e853..cf3da62bedbd78b91b5186bb3759f538c6e3241f 100644 (file)
@@ -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
index 566c4809f323cf52da9e3fc1023620805c3af9d2..5fbad0782d95aa1f2679def255d81198ff9df96f 100644 (file)
@@ -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
index 95d0e1537a0b884adc7d774bb82f84343a261345..4470efd1be150cfbf1dc02a7a89a6697176246f8 100644 (file)
@@ -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;
 }
index a22f9dcab20e5a4758170a739776c4d3b8a6e747..867bf66a1b44576a2561c8123904a6caad8722e0 100644 (file)
@@ -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&auml;ngt nun von der <strong>sql_patches</strong> 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&uuml;gt f&uuml;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") {
index 49cd292dcc1115d1a999b9a7ea29e4e19f0e2cf3..d66dc454d5688899ee9f6bfddc33712b3d765aed 100644 (file)
@@ -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;
 }
index b93312c63df80ee44da904b8a0fe8212ccdf4d21..3bbc10dac53486602e5c9e97029bab6f1c17956a 100644 (file)
@@ -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;
 }
index 0fcbff1d50111e22138d789541a3ce6eafede551..d6e8cc589b7a84d41abb0c871c31e1f4d781e466 100644 (file)
@@ -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;
 }
index 80f4b1d8539839ec571c34ea7a465d2cf5a663a7..1696640d88cd365924b36bc25e3eb3970027b73f 100644 (file)
@@ -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
index cc814d3e04db1b9c0d1c08a10140c136ecbbfb33..145076f9d0e4f1c4171da2325ecd9d6d43a2cf3c 100644 (file)
@@ -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;
 }
index 76a28076a000d3105d3a1b95b9ff8b9e15c04ed8..a25a89521c2cd94b7256e90893fe699245107f57 100644 (file)
@@ -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;
 }
index 39a2bb3988cdc57690df421f673d58df967470e1..688ffb93295059c3bfd523444e33b5bfab1c4248 100644 (file)
@@ -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;
 
index 93beba2e54f8ee72fd42c776390abc162934c871..4c2cd173acfb955b1237a48ea6c551bc81a456f2 100644 (file)
@@ -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;
 }
index 0f6d3ec4a02495f668a4530dc0bab6ac70cb9d97..d9e33674765b3b5c2b987d221b7c44551090d1ed 100644 (file)
@@ -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;
 }
index b1e7c63281b6b90597d6317c5521de21a9b5a2b9..b88d73a90c1f88ae88f95f4f8b26d0da7ea64542 100644 (file)
@@ -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;
 }
index b36b18e92941b7f11da9d8c667c5201a18982a06..6c7a38913c86662ad2bad6a54de764eaec40c6be 100644 (file)
@@ -127,18 +127,19 @@ Bitte stellen Sie diesen derzeit manuell unter <A href=\"".URL."/modules.php?mod
        }
        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;
 }
 
-if ((isset($dry_run)) && (isset($EXT_LOAD_MODE)))
-{
-       if ((!$dry_run) && ($EXT_LOAD_MODE == "update") && ($EXT_VER == "0.0.4"))
-       {
+if ((isset($dry_run)) && (isset($EXT_LOAD_MODE))) {
+       if ((!$dry_run) && ($EXT_LOAD_MODE == "update") && ($EXT_VER == "0.0.4")) {
                // Add auto-check file
                $INC_POOL[] = sprintf("%sinc/gen_mediadata.php", PATH);
-       }
-}
+       } // END - if
+} // END - if
 
 // Keep this extension always active!
 $EXT_ALWAYS_ACTIVE = "Y";
index 789110cb896e90a52a148ea6697f11328baa2dc2..641c9b9ddcb929fd4a8c5c3698a82dfec7adf46b 100644 (file)
@@ -112,6 +112,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;
 }
index ba2d35758affd644e2e06a1305f432271f6d5fa0..a1b08201edb7aa3d2c3c051240308d1e8220a061 100644 (file)
@@ -163,6 +163,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;
 }
index a091688eb7af57e0d481479333e8eb7f6f407f30..75e0e32d1ed584938a37d8b23504f6aa10bc20a7 100644 (file)
@@ -145,6 +145,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
        // URL ends which are used to indentify the end of an URL or email link
        // Don't use these chars in links... ;-)
@@ -164,8 +167,7 @@ default: // Do stuff when extension is loaded
                '2','3','4','5','6','7','8','9'
        );
 
-       if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
-       {
+       if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) {
                // Daily reset was run so let's check out for expired newsletter orders
                $INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", PATH);
        }
index e4bae74bde1ee7e525cd5506c05db7df9654e527..bb97b36a24a1ed3f9a50bbdb9c398013c26f2b7b 100644 (file)
@@ -197,6 +197,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
        // @TODO|@DEPRECATED Please rewrite these constants, LOAD_CONFIG() is no more needed in extensions
        $dummy = LOAD_CONFIG();
index b943ac16369ab0227acff424ee3a53375695b121..37eedd0c148e20bfb4bf7d038aa669682e864929 100644 (file)
@@ -111,6 +111,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;
 }
index 8ceb8dd168d73c10dc04c31016d8b65c5c51bd0c..4f9f5b772c1cbc76adc4a434fbd987669d594199 100644 (file)
@@ -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;
 }
index 938d97c57f807a520433fc2aca8ba6d340431c30..3197c40687fb3ed9e4545b5c38e7876712debfb0 100644 (file)
@@ -301,10 +301,12 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us
        }
        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 daily reset only when installed and extension version is at least 0.1.1
-       if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "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__);
        }
index 1cd35d485532991993c92c2cb2de5269dbe75416..4ddeb4b00618f801972702f07054470bcff7b5a4 100644 (file)
@@ -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;
 }
index 9cfc65648c04e6b469abf882ef6f2d3d1dbd63cb..8c7de0e4e569062f9e703d0e6573f9e396e0c596 100644 (file)
@@ -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;
 }
index 03b751f904415339ef9bc38d355827b1589c7edf..c7a1124755536f152f7691cc0d2082c43009c809 100644 (file)
@@ -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;
 }
index 9e4854d6c63774f08b9e182f8f8ff3e3c0fe0ff8..75a70b6bc528023f5a8288dff66ca784a510bfa4 100644 (file)
@@ -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);
        }
index d57fbcc07f73ef8d803b4c6813980bd01db14523..2f12e45136607687aaa29f1e7e8e5ac0311b06d3 100644 (file)
@@ -300,6 +300,9 @@ Zudem sollten Sie mindestens folgende Templates (in <STRONG>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;
 }
 
index 0816ffc79fb140d404d4e7685fbbb1be79191c6b..0d1f452a12656d01d21e8fce02cfd0a7ac8754a0 100644 (file)
@@ -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;
index 474f0a442ac335fcbb1d2a0b5546cc32b1df8b27..a310f2bca3cc7841cb9f0cb90d46025ef90525d6 100644 (file)
@@ -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;
 }
index 315194edab0274751bf254521a34123ee5263923..f60423146408fcc03d5390679ca4fdabcee96cbe 100644 (file)
@@ -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;
 }
index 80cc4a44b4e88c1a592e8ce16ab7e5c4a5c46a94..b5ab3794834a189493b663f5f6228227d5cfcc12 100644 (file)
@@ -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;
 }
index d3be324c8b64bf1b571660dbb8416203418f4472..e3b6c75f4dd44870feacac5ab55f356b3e8158a1 100644 (file)
@@ -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')){
index d8b9b855f5f9e11be5a95addd8d709887c55d648..f9859ec4a76620ac08f08ff4a72cb29ea2080af4 100644 (file)
@@ -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;
 }
index 84746d4e1eba1dda7b6eadfd89dd9286873cf653..22ae5c695b71d9c5a5613b3663429ac2cc0d9b7c 100644 (file)
@@ -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;
 }
index 8aa10db56dfadaa71b0ec0722353cfa52f10967a..a8518ffc07981a4f0db3f6f41b9ebfcae6223bed 100644 (file)
@@ -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 &quot;theme&quot; 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','&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standart-Theme &quot;default&quot; auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server l&ouml;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 <A href=\"http://www.mxchange.org\">281-Patch</A> (wenn Ihr Script v0.2.0-pre7 ist) herunter, da ansonsten die Themes nicht klappen werden!";
+               $UPDATE_NOTES = "Ung&uuml;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&auml;sst diese de- bzw. wieder aktivieren.', 17)";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Tabellen f&uuml;r Filter-System hinzugef&uuml;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") != '') {
index 2c5de7e81b68015fd10211b518d3fe0c3bc29796..fe9b03ee452cda723268b2e437d3e5dafe0bb6d1 100644 (file)
@@ -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;
 }
index 8c091b9b190fce80c98b7df7fa85063699e30160..fbb2cf5068a2385606e31ffa113ce7784665577b 100644 (file)
@@ -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");
index ca2829f6b557edbfba108527b0a53e5f299a67c4..c03ef7ac2fb3fc8b9a9d086077b0357d8db24e71 100644 (file)
@@ -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;
 }
index 7876bc5860285ad082833eea47c20f6c8b3ec024..39d74b135dec01880b6a72f9841ddeff6bce7d9f 100644 (file)
@@ -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&uuml;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&uuml;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 &quot;theme&quot; 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','&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standart-Theme &quot;default&quot; auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server l&ouml;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&uuml;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 <u>sql_patches</u> &uuml;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;
 }
index 5156f6dc0293da3ca0ddf2eaf5c8f18787fc16d3..92ad4d70c84369cdc425798cffdb28bd3291856b 100644 (file)
@@ -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;
 }
index 15748a8cbc1def330c190cd7b3daeb4cf6712c0f..a807ee29e3615220ec02dcb7d4bf3e49a011da4b 100644 (file)
@@ -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
index f6a258c964008e21cc748755a11d23ccb315ddbf..08c607e5446cc8edad3c7a9a21444ef69fd39ada 100644 (file)
@@ -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;
 }
index bce881bd1852617065493246369a143cdcc0f5c6..d8d32222ff5d987626fc5a0ca327158e425df6b9 100644 (file)
@@ -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();
-
 //
 ?>
index 4fad3694a8bd508eebc9c77ca16779104be0ffc1..ec21cec8594a92847043fe403521733349244d2b 100644 (file)
@@ -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 (file)
index 0000000..33c5922
--- /dev/null
@@ -0,0 +1,250 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 12/16/2008 *
+ * ===============                              Last change: 12/16/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : filters.php                                      *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for filter system                      *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Funktionen fuer Filter-System                    *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
+       require($INC);
+}
+
+// Init "generic filter system"
+function INIT_FILTER_SYSTEM() {
+       global $filters, $loadedFilters;
+
+       // Is the filter already initialized?
+       if ((isset($filters)) && (is_array($filters))) {
+               // Then abort here
+               ADD_FATAL(FILTER_FAILED_ALREADY_INIT);
+               return false;
+       } // END - if
+
+       // Init the filter system (just some ideas)
+       $filters = array(
+               // Filters for pre-init phase
+               'preinit'   => 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__."(<font color=\"#0000aa\">".__LINE__."</font>): name={$filterName}, func={$filterFunction}, active={$active}<br />\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);
+       }
+}
+
+//
+?>
index c911ac5554168ef6dc078ceab51fe11e8f146037..90f323b5c3c2fb2fb8c3b58ffe63df33f6b9d680 100644 (file)
@@ -73,27 +73,13 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) {
 
        // And the last closing HTML tag
        OUTPUT_HTML("</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("");
 
 //
 ?>
index de061a52f20c3308447babed89684e1272a9dd0a..4b87bcf918336e2c5b931795f3ab96606f0b42b0 100644 (file)
@@ -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__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template}<br />\n";
-       if ($UID > 0) {
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template},content[]=".gettype($content)."<br />\n";
+       if (($UID > 0) && (is_array($content))) {
+               // If nickname extension is installed, fetch nickname as well
                if (EXT_IS_ACTIVE("nickname")) {
                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />\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__."(<font color=\"#0000aa\">".__LINE__."</font>):content[]=".gettype($content)."<br />\n";
-               if (is_array($content)) {
-                       // Fetch and migrate data
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
-                       $content = array_merge($content, SQL_FETCHARRAY($result));
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\n";
-               } // END - if
+               // Fetch and merge data
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
+               $content = array_merge($content, SQL_FETCHARRAY($result));
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\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);
index 7c3860c9e386b9b781beb759cf65efce862850b1..b01597a871eff1f582a1dcf4251c94c1940b15e8 100644 (file)
@@ -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);
index cdede861769763078cd90b2c716e7d877d3b1323..3de3caa6e470ce2d07406a6825d675fa691de0ec 100644 (file)
@@ -1194,6 +1194,7 @@ define('MOD_REWRITE_ERROR', "Sie m&uuml;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 <u>%s/u> bereits geladen!");
 
 define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail <span class=\"data\">%s</span> best&auml;tigt.");
 define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;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 <u>%s</u> ist bereits der Filterkette <u>%s</u> hinzugef&uuml;gt.");
+define('FILTER_FAILED_NOT_FOUND', "Die Filterfunktion <u>%s</u> wurde nicht gefunden und konnte der Filterkette <u>%s</u> nicht hinzugef&uuml;gt werden.");
+define('FILTER_FAILED_NO_FILTER_FOUND', "Die Filterkette <u>%s</u> konnte nicht gefunden werden.");
+define('FILTER_FAILED_NOT_REMOVED', "Die Filterfunktion <u>%s</u> konnte nicht aus der Filterkette <u>%s</u> entfernt werden, da sie nicht existiert.");
+define('FILTER_FLUSH_FAILED_NO_DATABASE', "Kann die Filterketten nicht speichern. Datenbank fehlt!");
+
 //
 ?>
index f0cdd7536b26a48a8851eb191f1cadd0198f1748..48cff14598335f4ee5ba8294896737888a85803a 100644 (file)
@@ -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
index bb24447efda1ab67f3b79ec8dd00bbce66048dec..1004594d625bef8b02329b9315b7a37b0fb682e2 100644 (file)
@@ -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
+}
+
 //
 ?>
index 6f31bb5102e47ac9cebdf17eb13c3a5c26b813b4..8b879e251ca93a455269011b018144cc5eafe24d 100644 (file)
@@ -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 (file)
index 0000000..4d3be82
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 12/16/2008 *
+ * ===============                              Last change: 12/16/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : events_functions.php                             *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for the event system                   *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Funktionen fuer das Event-System                 *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+//
+?>
index 4c99be29ab945e564abe27a36cd0d6945b9362fb..978b87ba5a19a49fddfadfcaab28fde1fe1ccc9e 100644 (file)
@@ -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', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=solved\">".$value."</A>");
diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php
new file mode 100644 (file)
index 0000000..5adb09e
--- /dev/null
@@ -0,0 +1,312 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 12/03/2004 *
+ * ===============                              Last change: 12/13/2004 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : theme-manager.php                                *
+ * -------------------------------------------------------------------- *
+ * Short description : Theme manager                                    *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Themen-Manager                                   *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Always make sure the session management is initialized first
+require_once(PATH."inc/session.php");
+
+// Get current theme name
+function GET_CURR_THEME() {
+       global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
+
+       // The default theme is 'default'... ;-)
+       $ret = "default";
+
+       // Load default theme if not empty from configuration
+       if (!empty($_CONFIG['default_theme'])) $ret = $_CONFIG['default_theme'];
+
+       if (!isSessionVariableSet('mxchange_theme')) {
+               // Set default theme
+               set_session("mxchange_theme", $ret);
+       } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
+               //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
+               // 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 .= "&amp;action=".$act;
+       if (!empty($wht))   $FORM .= "&amp;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 .= "  <OPTION value=\"".$theme."\"";
+               if ($theme == GET_CURR_THEME()) $OUT .= " selected=\"selected\"";
+               $OUT .= ">".$THEMES['theme_name'][$key]."</OPTION>\n";
+       } // END - foreach
+
+       // Return generated selection
+       define('__THEME_SELECTION_OPTIONS', $OUT);
+       $OUT = LOAD_TEMPLATE("theme_select_form", true);
+       return $OUT;
+}
+
+// Get version from name
+function THEME_GET_VERSION ($name) {
+       global $cacheArray, $_CONFIG;
+
+       // Is the extension "theme" installed?
+       if (!EXT_IS_ACTIVE("theme")) {
+               // Then abort here
+               return "0.0";
+       } // END - if
+
+       // Default version "number"
+       $cver = "-.-";
+
+       // Is the cache entry there?
+       if (isset($cacheArray['themes']['theme_ver'][$name])) {
+               // Get the version from cache
+               $cver = $cacheArray['themes']['theme_ver'][$name];
+
+               // Count up
+               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",
+                       array($name), __FILE__, __LINE__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Fetch data
+                       list($cver) = SQL_FETCHROW($result);
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+
+       // Return version
+       return $cver;
+}
+
+// Get id from theme
+function THEME_GET_ID ($name) {
+       global $cacheArray, $_CONFIG;
+
+       // Is the extension "theme" installed?
+       if (!EXT_IS_ACTIVE("theme")) {
+               // Then abort here
+               return 0;
+       } // END - if
+
+       // Default id
+       $id = 0;
+
+       // Is the cache entry there?
+       if (isset($cacheArray['themes']['id'][$name])) {
+               // Get the version from cache
+               $id = $cacheArray['themes']['id'][$name];
+
+               // Count up
+               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",
+                       array($name), __FILE__, __LINE__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Fetch data
+                       list($id) = SQL_FETCHROW($result);
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+
+       // Return id
+       return $id;
+}
+
+// Checks wether a theme is found in db
+function THEME_CHECK_EXIST ($name) {
+       // Get theme and is it not nul?
+       return (THEME_GET_ID($name) > 0);
+}
+
+// Checks if a theme is active
+function THEME_IS_ACTIVE ($name) {
+       global $cacheArray, $_CONFIG;
+
+       // Is the extension "theme" installed?
+       if (!EXT_IS_ACTIVE("theme")) {
+               // Then abort here
+               return false;
+       } // END - if
+
+       // Default is nothing active
+       $active = false;
+
+       // Is the cache entry there?
+       if (isset($cacheArray['themes']['theme_active'][$name])) {
+               // Get the version from cache
+               $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
+
+               // Count up
+               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",
+                       array($name), __FILE__, __LINE__);
+
+               // Is the theme active and installed?
+               $active = (SQL_NUMROWS($result) == 1);
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+
+       // Return result
+       return $active;
+}
+
+// Gets current human-readable theme name
+function GET_CURR_THEME_NAME () {
+       global $cacheArray, $_CONFIG;
+
+       // Is the extension "theme" installed?
+       if (!EXT_IS_ACTIVE("theme")) {
+               // Then abort here
+               return "default";
+       } // END - if
+
+       // Get the Uni* name
+       $name = GET_CURR_THEME();
+
+       // Is the cache entry there?
+       if (isset($cacheArray['themes']['theme_name'][$name])) {
+               // Get the version from cache
+               $name = $cacheArray['themes']['theme_name'][$name];
+
+               // Count up
+               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",
+                       array($name), __FILE__, __LINE__);
+
+               // Load theme name
+               list($name) = SQL_FETCHROW($result);
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+
+       // Return name
+       return $name;
+}
+
+// Initialize variables
+$currTheme = GET_CURR_THEME();
+
+// Check if new theme is selcted
+if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
+       // Set new theme for guests
+       $newTheme = $_POST['new_theme'];
+
+       // Change to new theme
+       set_session("mxchange_theme", $newTheme);
+
+       // Remove current from array and set new
+       $theme = sprintf("%stheme/%s/theme.php", PATH, $currTheme);
+       unset($INC_POOL[array_search($theme, $INC_POOL)]);
+       $INC_POOL[] = sprintf("%stheme/%s/theme.php", PATH, $newTheme);
+} // END - if
+
+//
+?>
index fbc9d61047ebe46019d24b99d8a7827a28a13c2f..b31dfe68d10ac1050a06044ce3dfe0982ec427bd 100644 (file)
@@ -188,8 +188,8 @@ $DEL = array();
 
 // At least one found?
 if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") && ($CSS != "-1")) || ($cacheMode == "no"))) {
-       // Load theme management
-       require_once(PATH."inc/theme-manager.php");
+       // Load session management
+       require_once(PATH."inc/session.php");
 
        // Extensions are registered so we load them
        while ($content = SQL_FETCHARRAY($res_ext_crt)) {
index ea744f2f33abdc18eb763aea91bd0d1c51d37756..0a6951b998c4a3147572530a631349d905dc63cd 100644 (file)
@@ -214,7 +214,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                        // Rewrite overview module
                        if ($GLOBALS['what'] == "overview") {
                                $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
-                       }
+                       } // END - if
 
                        // Add data to URL
                        if (!empty($GLOBALS['what'])) $URL .= "what=".$GLOBALS['what'];
@@ -236,8 +236,10 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                        $ret = WRONG_PASS." [<A href=\"".URL."/modules.php?module=admin&amp;reset_pass=1\">".ADMIN_RESET_PASS."</A>]\n";
                        DESTROY_ADMIN_SESSION();
                        break;
-               }
-       }
+               } // END - switch
+       } // END - if
+
+       // Error detected?
        if ($ret != "done") {
                if (!empty($_POST['login'])) {
                        define('__LOGIN_VALUE', $_POST['login']);
@@ -247,8 +249,8 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
 
                if (isset($_POST['ok'])) {
                        // Set messages to zero
-
                        $MSG1 = ""; $MSG2 = "";
+
                        // No login entered?
                        if (empty($_POST['login'])) $MSG1 = ADMIN_NO_LOGIN;
 
@@ -298,7 +300,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
 
                // Load login form template
                LOAD_TEMPLATE("admin_login_form", false, $content);
-       }
+       } // END - if
 } elseif (isset($_GET['logout'])) {
        // Only try to remove cookies
        if (DESTROY_ADMIN_SESSION()) {
index b4d858b7236e31985c00c77ca31056942f4446a4..78bfa36ec9bbc48507db04b98b6516c62ea81917 100644 (file)
@@ -1292,6 +1292,9 @@ function ADMIN_RESET_PASSWORD ($login, $password) {
        SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s' WHERE login='%s' LIMIT 1",
                array($passHash, $login), __FILE__, __LINE__);
 
+       // Run filters
+       RUN_FILTER('post_admin_reset_pass', array('login' => $login, 'hash' => $passHash));
+
        // Return output
        return ADMIN_PASSWORD_RESET_DONE;
 }
index c6cba4a8c924f154ce48ba3c5bee0da2eb744ee1..6035ba9756cce8b0dcad978ee8c70d0a9190e45e 100644 (file)
@@ -52,20 +52,18 @@ if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email
        if (SQL_NUMROWS($result) == 0) {
                // Login does not exist so we can create it.
                $FORM = false;
-               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s','%s','%s')",
-                array($_POST['login'], generateHash($_POST['pass1']), $_POST['email']), __FILE__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s','%s','%s')",
+                       array($_POST['login'], generateHash($_POST['pass1']), $_POST['email']), __FILE__, __LINE__);
 
                // Admin login saved
                LOAD_TEMPLATE("admin_settings_saved", false, "<FONT class=\"admin_done\">".ADMIN_ADMINS_ADD_DONE."</FONT>");
 
-               // Remove cache file
-               if (EXT_IS_ACTIVE("cache")) {
-                       if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
-               }
-       } else {
-               // Free memory
-               SQL_FREERESULT($result);
-       }
+               // Run filter chain
+               RUN_FILTER('post_admin_added', $_POST);
+       } // END - if
+
+       // Free memory
+       SQL_FREERESULT($result);
 }
 
 if ($FORM) {
index d75af2b14c8d7a5f3335d82f919f377ebcad03ca..196bd01558baa4d0384bf310b79577f469755ce2 100644 (file)
@@ -301,7 +301,7 @@ case "register": // Register new extension
                        $ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1));
 
                        // Test the extension for deprecation
-                       $EXT_DEPRECATED = "N"; $EXT_LOAD_MODE = "";
+                       $EXT_DEPRECATED = "N"; $EXT_LOAD_MODE = "test";
                        include(PATH."inc/extensions/ext-".$ext_name.".php");
 
                        // Is the extension deprecated?
index ad62a503e465398de0261406629f8cf3f7e1144c..f52848abc04bb0db01758ac92c0ba85d5d5511af 100644 (file)
@@ -43,9 +43,12 @@ define('DEBUG_SQL', false);
 // Load database library
 require_once(PATH."inc/db/lib.php");
 
-// // Non-database functions
+// Non-database functions
 require_once(PATH."inc/functions.php");  
 
+// Filter functions
+require_once(PATH."inc/filters.php");  
+
 // Functions which interact with the database
 require_once(PATH."inc/mysql-manager.php");
 
@@ -71,7 +74,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
                die("Error message written to debug.log. Please try to call <a href=\"".URL."\">the main page</a> to continue.");
        } else {
                // No debug extension found
-               print("Please report this error at <a href=\"http://forum.mxchange.org\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
+               print("Please report this error at <a href=\"http://forum.mxchange.org\" rel=\"external\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
                debug_print_backtrace();
                die("</pre>Thank you for your help finding bugs.");
        }
@@ -80,6 +83,15 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
 // Set error handler
 set_error_handler('__errorHandler');
 
+// Call-back function for running shutdown functions
+function __run_shutdown_filter () {
+       // Call the filter chain 'shutdown'
+       RUN_FILTER('shutdown', null, false);
+}
+
+// Register shutdown hook
+register_shutdown_function('__run_shutdown_filter');
+
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
        // No login entered and outside installation mode
@@ -133,8 +145,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                // Loading patching system is required here...
                                require_once(PATH."inc/patch-system.php"); // Initialize patch system
 
-                               // Functions which are related to themes
-                               require_once(PATH."inc/theme-manager.php");
+                               // Session management
+                               require_once(PATH."inc/session.php");
 
                                // Run daily reset
                                require_once(PATH."inc/check-reset.php");
@@ -241,7 +253,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
 
        // Include required files
        require_once(PATH."inc/databases.php");
-       require_once(PATH."inc/theme-manager.php");
+       require_once(PATH."inc/session.php");
 
        // Check if we are in installation routine
        $installPhp = basename($_SERVER['PHP_SELF']);
@@ -253,29 +265,31 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        // Double-check installation mode
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
                // Check for file permissions
-               if (!is_INCWritable("config")) {
+               if (!IS_INC_WRITEABLE("config")) {
                        ADD_FATAL(CONFIG_IS_WRITE_PROTECTED);
-               }
-               if (!is_INCWritable("dummy")) {
+               } // END - if
+               if (!IS_INC_WRITEABLE("dummy")) {
                        ADD_FATAL(DUMMY_IS_WRITE_PROTECTED);
-               }
-               if (!is_INCWritable(".secret/dummy")) {
+               } // END - if
+               if (!IS_INC_WRITEABLE(".secret/dummy")) {
                        ADD_FATAL(SECRET_IS_WRITE_PROTECTED);
-               }
+               } // END - if
        } // END - if
 }
 
+// Init filter system
+INIT_FILTER_SYSTEM();
+
 // Any fatal messages?
 if (!is_array($FATAL)) $FATAL = array();
-if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1"))
-{
+if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1")) {
        // One or more fatal error(s) occur during connect...
        include (PATH."inc/header.php");
        include (PATH."inc/fatal_errors.php");
        unset($FATAL);
        include (PATH."inc/footer.php");
        exit;
-}
+} // END - if
 
 //
 ?>
index 4647c5a00f06e52214d44d34a71742ba287ec004..9d357e6dadcc14ddd7c92c97547e75994b5b96de 100644 (file)
@@ -945,7 +945,7 @@ function GET_ACTION ($MODE, &$wht)
                // Get it directly from URL
                return $GLOBALS['action'];
        }
-       //* DEBUG: */ echo __LINE__."*".$ret."*<br />\n";
+       //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />\n";
 
        if (MODULE_HAS_MENU($MODE)) {
                // Rewriting modules to menu
@@ -959,7 +959,7 @@ function GET_ACTION ($MODE, &$wht)
 
                // Load from database
                $result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1",
-                array($MODE, $wht), __FILE__, __LINE__);
+                       array($MODE, $wht), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load action value and pray that this one is the right you want... ;-)
                        list($ret) = SQL_FETCHROW($result);
@@ -1700,7 +1700,7 @@ function ADD_JACKPOT($points) {
 
                // Update points
                $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points+%s WHERE ok='ok' LIMIT 1",
-                array($points), __FILE__, __LINE__);
+                       array($points), __FILE__, __LINE__);
        }
 }
 //
@@ -1792,8 +1792,9 @@ function GET_WHAT($modCheck) {
        // Return what value
        return $wht;
 }
-//
-function MODULE_HAS_MENU($mod, $forceDb = false) {
+
+// Checks if the module has a menu
+function MODULE_HAS_MENU ($mod, $forceDb = false) {
        global $cacheArray, $_CONFIG;
 
        // All is false by default
@@ -1809,12 +1810,18 @@ function MODULE_HAS_MENU($mod, $forceDb = false) {
                        // Check cache and count hit
                        $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
                        if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               } elseif ((IS_ADMIN()) && ($mod == "admin")) {
+                       // Admin module has always a menu!
+                       $ret = true;
                }
        } elseif ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ((!EXT_IS_ACTIVE("cache")) || ($forceDb === true))) {
                // Check database for entry
                $result = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
-                array($mod), __FILE__, __LINE__);
+                       array($mod), __FILE__, __LINE__);
+
+               // Entry found?
                if (SQL_NUMROWS($result) == 1) {
+                       // Load "has_menu" column
                        list($has_menu) = SQL_FETCHROW($result);
 
                        // Fake cache... ;-)
@@ -1832,6 +1839,7 @@ function MODULE_HAS_MENU($mod, $forceDb = false) {
        }
 
        // Return status
+       //* DEBUG: */ var_dump($ret);
        return $ret;
 }
 
index 10341b96e8652fcb0e7832a3922b69beca7866dd..4d7c214aaff4ab4a87f267a738130a9994816cf0 100644 (file)
@@ -54,14 +54,12 @@ if (($CSS == "1") || ($_CONFIG['css_php'] == "DIRECT")) {
        if (is_array($EXT_CSS_FILES)) {
                // Load extension's CSS files
                foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
-       }
+       } // END - if
 
        // Create missing configuration file
        if (!function_exists('GET_CURR_THEME')) {
-               // Dummy for e.g. down database links
-               function GET_CURR_THEME () {
-                       return "default";
-               }
+               // Load dummy theme functions
+               require_once(PATH."inc/theme-dummy.php");
        } // END - if
 
        // Output inclusion lines
diff --git a/inc/theme-dummy.php b/inc/theme-dummy.php
new file mode 100644 (file)
index 0000000..e4beb87
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 12/16/2008 *
+ * ===============                              Last change: 12/16/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : theme-dummy.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Dummy functions for theme manager                *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Platzhalter-Funktionen fuer Theme-Manager        *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif (EXT_IS_ACTIVE("theme")) {
+       // Abort loading here
+       ADD_FATAL(sprintf(FATAL_EXTENSION_LOADED, "theme"));
+       return;
+}
+
+// Dummy getter for current theme
+function GET_CURR_THEME () {
+       return "default";
+}
+
+//
+?>
index 44b82d17ddaae68eac654c5f3efdb598ce073d55..f87b68fd319130d505ca122256bd7490eb3d0a92 100644 (file)
@@ -1,288 +1,3 @@
 <?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 12/03/2004 *
- * ===============                              Last change: 12/13/2004 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : theme-manager.php                                *
- * -------------------------------------------------------------------- *
- * Short description : Theme manager                                    *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Themen-Manager                                   *
- * -------------------------------------------------------------------- *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
- *                                                                      *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or    *
- * (at your option) any later version.                                  *
- *                                                                      *
- * This program is distributed in the hope that it will be useful,      *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
- * GNU General Public License for more details.                         *
- *                                                                      *
- * You should have received a copy of the GNU General Public License    *
- * along with this program; if not, write to the Free Software          *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-}
-
-// Always make sure the session management is initialized first
-require_once(PATH."inc/session.php");
-
-// Get current theme name
-function GET_CURR_THEME() {
-       global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
-
-       // The default theme is 'default'... ;-)
-       $ret = "default";
-
-       // Load default theme if not empty from configuration
-       if (!empty($_CONFIG['default_theme'])) $ret = $_CONFIG['default_theme'];
-
-       if (!isSessionVariableSet('mxchange_theme')) {
-               // Set default theme
-               set_session("mxchange_theme", $ret);
-       } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
-               //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
-               // 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 .= "&amp;action=".$act;
-       if (!empty($wht))   $FORM .= "&amp;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 .= "  <OPTION value=\"".$theme."\"";
-               if ($theme == GET_CURR_THEME()) $OUT .= " selected=\"selected\"";
-               $OUT .= ">".$THEMES['theme_name'][$key]."</OPTION>\n";
-       } // END - foreach
-
-       // Return generated selection
-       define('__THEME_SELECTION_OPTIONS', $OUT);
-       $OUT = LOAD_TEMPLATE("theme_select_form", true);
-       return $OUT;
-}
-
-// Get version from name
-function THEME_GET_VERSION ($name) {
-       global $cacheArray, $_CONFIG;
-
-       // Default version "number"
-       $cver = "-.-";
-
-       // Is the cache entry there?
-       if (isset($cacheArray['themes']['theme_ver'][$name])) {
-               // Get the version from cache
-               $cver = $cacheArray['themes']['theme_ver'][$name];
-
-               // Count up
-               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",
-                       array($name), __FILE__, __LINE__);
-
-               // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Fetch data
-                       list($cver) = SQL_FETCHROW($result);
-               } // END - if
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-
-       // Return version
-       return $cver;
-}
-
-// Get id from theme
-function THEME_GET_ID ($name) {
-       global $cacheArray, $_CONFIG;
-
-       // Default id
-       $id = 0;
-
-       // Is the cache entry there?
-       if (isset($cacheArray['themes']['id'][$name])) {
-               // Get the version from cache
-               $id = $cacheArray['themes']['id'][$name];
-
-               // Count up
-               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",
-                       array($name), __FILE__, __LINE__);
-
-               // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Fetch data
-                       list($id) = SQL_FETCHROW($result);
-               } // END - if
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-
-       // Return id
-       return $id;
-}
-
-// Checks wether a theme is found in db
-function THEME_CHECK_EXIST ($name) {
-       // Get theme and is it not nul?
-       return (THEME_GET_ID($name) > 0);
-}
-
-// Checks if a theme is active
-function THEME_IS_ACTIVE ($name) {
-       global $cacheArray, $_CONFIG;
-
-       // Default is nothing active
-       $active = false;
-
-       // Is the cache entry there?
-       if (isset($cacheArray['themes']['theme_active'][$name])) {
-               // Get the version from cache
-               $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
-
-               // Count up
-               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",
-                       array($name), __FILE__, __LINE__);
-
-               // Is the theme active and installed?
-               $active = (SQL_NUMROWS($result) == 1);
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-
-       // Return result
-       return $active;
-}
-
-// Gets current human-readable theme name
-function GET_CURR_THEME_NAME () {
-       global $cacheArray, $_CONFIG;
-
-       // Get the Uni* name
-       $name = GET_CURR_THEME();
-
-       // Is the cache entry there?
-       if (isset($cacheArray['themes']['theme_name'][$name])) {
-               // Get the version from cache
-               $name = $cacheArray['themes']['theme_name'][$name];
-
-               // Count up
-               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",
-                       array($name), __FILE__, __LINE__);
-
-               // Is the theme active and installed?
-               $name = (SQL_NUMROWS($result) == 1);
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-
-       // Return name
-       return $name;
-}
-
-// Initialize variables
-$currTheme = GET_CURR_THEME();
-
-// Check if new theme is selcted
-if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
-       // Set new theme for guests
-       $newTheme = $_POST['new_theme'];
-
-       // Change to new theme
-       set_session("mxchange_theme", $newTheme);
-
-       // Remove current from array and set new
-       $theme = sprintf("%stheme/%s/theme.php", PATH, $currTheme);
-       unset($INC_POOL[array_search($theme, $INC_POOL)]);
-       $INC_POOL[] = sprintf("%stheme/%s/theme.php", PATH, $newTheme);
-} // END - if
-
-//
+// DEPRECATED!
 ?>