]> git.mxchange.org Git - mailer.git/commitdiff
Began to rewrite whole script for newly added filters, new extension stub 'network...
authorRoland Häder <roland@mxchange.org>
Thu, 18 Dec 2008 15:55:41 +0000 (15:55 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 18 Dec 2008 15:55:41 +0000 (15:55 +0000)
32 files changed:
.gitattributes
inc/autopurge.php
inc/check-reset.php
inc/databases.php
inc/extensions.php
inc/extensions/ext-admins.php
inc/extensions/ext-cache.php
inc/extensions/ext-network.php [new file with mode: 0644]
inc/extensions/ext-rallye.php
inc/extensions/ext-removeip.php
inc/extensions/ext-sql_patches.php
inc/filters.php
inc/functions.php
inc/language/de.php
inc/language/en.ph
inc/libs/admins_functions.php
inc/libs/cache_functions.php
inc/libs/rallye_functions.php
inc/libs/refback_functions.php
inc/libs/removeip_functions.php
inc/load_cache.php
inc/load_extensions.php
inc/loader/load_cache-admin.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-list_newsletter.php
inc/modules/admin/what-list_payouts.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/pool-update.php
templates/de/html/ext/ext_network.tpl [new file with mode: 0644]

index 28a5f71f68020336f4affc509e5540b939db7c7c..c7bc9ac2234d3fae5f5702531e477a08cde10218 100644 (file)
@@ -121,6 +121,7 @@ inc/extensions/ext-maintenance.php -text
 inc/extensions/ext-mediadata.php -text
 inc/extensions/ext-mods.php -text
 inc/extensions/ext-mydata.php -text
+inc/extensions/ext-network.php -text
 inc/extensions/ext-newsletter.php -text
 inc/extensions/ext-nickname.php -text
 inc/extensions/ext-online.php -text
@@ -1225,6 +1226,7 @@ templates/de/html/ext/ext_maintenance.tpl -text
 templates/de/html/ext/ext_mediadata.tpl -text
 templates/de/html/ext/ext_mods.tpl -text
 templates/de/html/ext/ext_mydata.tpl -text
+templates/de/html/ext/ext_network.tpl -text
 templates/de/html/ext/ext_newsletter.tpl -text
 templates/de/html/ext/ext_nickname.tpl -text
 templates/de/html/ext/ext_online.tpl -text
index 15e1832d90e0b7b20f9992ecf6cf887da4ddd377..c3a206f0fb2214e6fa7e05150a2ad64819f47c6c 100644 (file)
@@ -40,20 +40,11 @@ if (!defined('__SECURITY')) {
 // Load all includes
 $INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/autopurge/", "purge-");
 
-// Include them all
-foreach ($INC_POOL as $fqfn) {
-       // Load them only once
-       require_once($fqfn);
-} // END - foreach
+// Run the filter
+RUN_FILTER('load_includes');
 
-// Remove array
-unset($INC_POOL);
-
-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
+// Run filters for extra autopurge
+RUN_FILTER('extra_autopurge');
 
 //
 ?>
index bef0aef20cc7459f4af5d9227362fbd75f0a2fab..cf6c67c6aa2e453babb1c695fd65f0710c01176e 100644 (file)
@@ -46,22 +46,8 @@ if ((date("d", getConfig('last_update')) != date("d", time())) && ((!defined('mx
        // Add more includes
        $INC_POOL = RESET_ADD_INCLUDES();
 
-       // Is this not an array?
-       if (!is_array($INC_POOL)) {
-               // Log the error
-               DEBUG_LOG(basename(__FILE__).":INC_POOL is no array!");
-
-               // Skip further executions
-               return;
-       } // END - if
-
-       // Run the full reset scripts
-       foreach ($INC_POOL as $incFile) {
-               require_once($incFile);
-       } // END - foreach
-
-       // Remove array
-       unset($INC_POOL);
+       // Run the filter
+       RUN_FILTER('load_includes');
 } // END - if
 
 //
index f2398157f121b587ca77a64c793d2e7b5e93b5ba..0f418377e281de0741cbb3b4a044d9ea88cc74f8 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "650");
+define('CURR_SVN_REVISION', "651");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index d95384706f28812a36822505e4955a043326bbd9..df5e51e9e67c0fbb6985b3e3ae59f0f86ebd32bc 100644 (file)
@@ -38,8 +38,8 @@ if (!defined('__SECURITY')) {
 }
 
 // Load the extension and maybe found language and function files.
-function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false) {
-       global $EXT_LOADED, $_CONFIG, $CSS, $cacheMode, $SQLs, $EXT_VER_HISTORY;
+function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false, &$SQLs = array()) {
+       global $EXT_LOADED, $_CONFIG, $CSS, $cacheMode, $EXT_VER_HISTORY;
        global $INC_POOL, $EXT_UPDATE_DEPENDS, $EXT_DEPRECATED, $UPDATE_NOTES;
        global $EXT_VERSION, $EXT_ALWAYS_ACTIVE;
 
@@ -123,10 +123,11 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        return true;
 }
 
-//
-function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
+// Registeres an extension and possible update depencies
+function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
        global $UPDATE_NOTES, $_CONFIG, $INC_POOL, $cacheInstance;
        global $EXT_VER_HISTORY, $SQLs, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
+       global $EXT_UPDATE_DEPENDS;
 
        // This shall never do a non-admin user!
        if (!IS_ADMIN()) return false;
@@ -145,13 +146,13 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
        $EXT_REPORTS_FAILURE = false;
 
        // Does this extension exists?
-       if (LOAD_EXTENSION($ext_name, "register", "", $dry_run)) {
+       if (LOAD_EXTENSION($ext_name, "register", "", $dry_run, $SQLs)) {
                // And run possible updates
                $history = $EXT_VER_HISTORY;
                foreach ($history as $ver) {
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ext_name={$ext_name}, ext_ver={$ver}");
                        // Load extension in update mode
-                       LOAD_EXTENSION($ext_name, "update", $ver, $dry_run);
+                       LOAD_EXTENSION($ext_name, "update", $ver, $dry_run, $SQLs);
 
                        // Do we have an update?
                        if (((GET_EXT_VERSION("sql_patches") != "") && (getConfig('verbose_sql') == "Y")) || (!EXT_IS_ACTIVE("sql_patches"))) {
@@ -175,32 +176,26 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
                        $SQLs2 = $SQLs;
                        $SQLs  = array();
                        $test  = false;
+                       $ext_update = $EXT_UPDATE_DEPENDS;
 
                        // Check for required file
-                       if (LOAD_EXTENSION($EXT_UPDATE_DEPENDS, "register", "", $dry_run)) {
+                       if (LOAD_EXTENSION($ext_update, "register", "", $dry_run, $SQLs)) {
                                // If versions mismatch update extension first
-                               $ext_ver = GET_EXT_VERSION($EXT_UPDATE_DEPENDS);
+                               $ext_ver = GET_EXT_VERSION($ext_update);
 
                                // Extension version set? If empty the extension is not registered
                                if (empty($ext_ver)) {
                                        // Extension not registered so far so first load task's ID...
-                                       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE task_type='EXTENSION' AND subject LIKE '[%s:]%%' LIMIT 1",
-                                               array($EXT_UPDATE_DEPENDS), __FILE__, __LINE__);
+                                       $task = DETERMINE_EXTENSION_TASK_ID($ext_update);
 
                                        // Entry found?
-                                       if (SQL_NUMROWS($result) == 1) {
-                                               // Task found so load task's ID and register extension...
-                                               list($task) = SQL_FETCHROW($result);
-
+                                       if ($task > 0) {
                                                // Try to register the extension
-                                               $test = EXTENSION_REGISTER($EXT_UPDATE_DEPENDS, $task, $dry_run);
+                                               $test = EXTENSION_REGISTER($ext_update, $task, $dry_run, false);
                                        } // END - if
-
-                                       // Free result
-                                       SQL_FREERESULT($result);
                                } elseif ($ext_ver != $EXT_VERSION) {
                                        // Ok, update this extension now
-                                       EXTENSION_UPDATE(basename($file), $EXT_UPDATE_DEPENDS, $ext_ver, $dry_run);
+                                       EXTENSION_UPDATE($ext_update, $ext_ver, $dry_run);
 
                                        // All okay!
                                        $test = true;
@@ -231,53 +226,18 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
                if ($test) {
                        // "Dry-run-mode" activated?
                        if (!$dry_run) {
-                               // Run all SQLs
-                               foreach ($SQLs as $sql) {
-                                       // Trim spaces away which we don't need
-                                       $sql = trim($sql);
-
-                                       // Is there still an SQL query?
-                                       if (!empty($sql)) {
-                                               // Do we have an "ALTER TABLE" command?
-                                               if (substr(strtolower($sql), 0, 11) == "alter table") {
-                                                       // Analyse the alteration command
-                                                       SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
-                                               } else {
-                                                       // Run regular SQL command
-                                                       $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
-                                               }
-                                       } // END - if
-                               } // END - foreach
-
-                               // Remove cache file(s) if extension is active
-                               RUN_FILTER('post_extension_installed', $ext_name);
-
-                               // Check for added include files
-                               if (count($INC_POOL > 0)) {
-                                       // Loads every include file
-                                       foreach ($INC_POOL as $inc) {
-                                               require_once($inc);
-                                       } // END - foreach
-
-                                       // Remove array
-                                       unset($INC_POOL);
-                               } // END - if
+                               // Run installation pre-installation filters
+                               RUN_FILTER('pre_extension_installed', false);
 
                                // Register extension
                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
                                        array($ext_name, $EXT_ALWAYS_ACTIVE, $EXT_VERSION), __FILE__, __LINE__);
 
-                               // Update task management
-                               ADMIN_SOLVE_TASK($task_id);
-
-                               // @TODO This causes the whole (!) menu cache being purged
-                               CACHE_PURGE_ADMIN_MENU();
+                               // Remove cache file(s) if extension is active
+                               RUN_FILTER('post_extension_installed', array('ext_name' => $ext_name, 'task_id' => $task_id));
 
                                // In normal mode return a true on success
                                $ret = true;
-
-                               // Remove SQLs
-                               unset($SQLs);
                        } else {
                                // Rewrite SQL command to keep { and } inside
                                foreach ($SQLs as $key => $sql) {
@@ -298,15 +258,21 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
        } elseif (($task_id > 0) && (!empty($ext_name))) {
                // Remove task from system when id and extension's name is valid
                $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND status='NEW' LIMIT 1",
-                array(bigintval($task_id)), __FILE__, __LINE__);
+                       array(bigintval($task_id)), __FILE__, __LINE__);
        }
 
        // Is this the sql_patches?
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":{$ext_name}/{$EXT_LOAD_MODE}");
        if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove")) && (!$dry_run) && ($test)) {
-               // Then redirect to logout
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
-               LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches");
+               if ($logout) {
+                       // Then redirect to logout
+                       LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches");
+               } else {
+                       // Add temporary filter
+                       REGISTER_FILTER('shutdown', 'REDIRECT_TO_LOGOUT_SQL_PATCHES', true, true);
+                       $GLOBALS['ext_load_mode'] = $EXT_LOAD_MODE;
+               }
        } // END - if
 
        // Return status code
@@ -316,24 +282,24 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run=false) {
 // Run SQL queries for given extension id
 // @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
 function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
-       global $cacheInstance, $_CONFIG, $SQLs;
+       global $cacheInstance, $_CONFIG;
 
-       // Extensions are never active by default
-       $EXT_ALWAYS_ACTIVE = "N";
+       // This shall never do a non-admin user!
+       if (!IS_ADMIN()) return false;
+
+       // Init array
+       $SQLs = array();
 
        // By default no SQL has been executed
        $sqlRan = false;
 
-       // This shall never do a non-admin user!
-       if (!IS_ADMIN()) return false;
-
        // Get extension's name
        $ext_name = GET_EXT_NAME($ext_id);
        if (empty($ext_name)) return false;
 
        // Load extension in detected mode
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":ext_name[{$ext_id}]={$ext_name}");
-       LOAD_EXTENSION($ext_name, $load_mode);
+       LOAD_EXTENSION($ext_name, $load_mode, false, $SQLs);
 
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".count($SQLs)."");
        if ((is_array($SQLs) && (sizeof($SQLs) > 0))) {
@@ -371,9 +337,6 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
        if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($load_mode == "activate") || ($load_mode == "deactivate"))) {
                // Run filters
                RUN_FILTER('post_extension_run_sql', $ext_name);
-
-               // @TODO This causes the whole (!) menu cache being purged
-               CACHE_PURGE_ADMIN_MENU();
        } // END - if
 
        // Is this the sql_patches?
@@ -396,7 +359,7 @@ function EXT_IS_ACTIVE ($ext_name) {
        $active = "N";
 
        // Check cache
-       if (!empty($cacheArray['extensions']['ext_active'][$ext_name])) {
+       if (isset($cacheArray['extensions']['ext_active'][$ext_name])) {
                // Load from cache
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "CACHE! ext_name={$ext_name}");
                $active = $cacheArray['extensions']['ext_active'][$ext_name];
@@ -410,14 +373,11 @@ function EXT_IS_ACTIVE ($ext_name) {
                        array($ext_name), __FILE__, __LINE__);
 
                // Entry found?
-               if (SQL_NUMROWS($result) == 0) {
-                       // Extension was not found!
-                       return false;
+               if (SQL_NUMROWS($result) == 1) {
+                       // Load entry
+                       list($active) = SQL_FETCHROW($result);
                } // END - if
 
-               // Load entry
-               list($active) = SQL_FETCHROW($result);
-
                // Free result
                SQL_FREERESULT($result);
 
@@ -439,40 +399,48 @@ function EXT_IS_ACTIVE ($ext_name) {
 // Get version from extensions
 function GET_EXT_VERSION ($ext_name) {
        global $cacheArray, $_CONFIG, $cacheInstance;
-       $ret = false;
+       $ext_ver = false;
 
        // Extensions are all inactive during installation
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return "";
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ext_name={$ext_name}");
 
        // Is the cache written?
-       if (!empty($cacheArray['extensions']['ext_version'][$ext_name])) {
+       if (isset($cacheArray['extensions']['ext_version'][$ext_name])) {
                // Load data from cache
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": CACHE!");
-               $ret = $cacheArray['extensions']['ext_version'][$ext_name];
+               $ext_ver = $cacheArray['extensions']['ext_version'][$ext_name];
 
                // Count cache hits
                if (getConfig('cache_hits') > 0) $_CONFIG['cache_hits']++; else $_CONFIG['cache_hits'] = 1;
        } elseif (!is_object($cacheInstance)) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
-                array($ext_name), __FILE__, __LINE__);
-               list($ret) = SQL_FETCHROW($result);
+                       array($ext_name), __FILE__, __LINE__);
+
+               // Is the extension there?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Load entry
+                       list($ext_ver) = SQL_FETCHROW($result);
+               } // END - if
+
+               // Free result
                SQL_FREERESULT($result);
 
                // Set cache
-               $cacheArray['extensions']['ext_version'][$ext_name] = $ret;
+               $cacheArray['extensions']['ext_version'][$ext_name] = $ext_ver;
        }
 
        // Return result
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ret={$ret}");
-       return $ret;
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ret={$ext_ver}");
+       return $ext_ver;
 }
-//
-function EXTENSION_UPDATE ($file, $ext_name, $ext_ver, $dry_run=false) {
+
+// Updates a given extension with current extension version to latest version
+function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
        // This shall never do a non-admin user!
        global $cacheInstance, $_CONFIG, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
-       global $EXT_UPDATE_DEPENDS, $EXT_VERSION;
+       global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $SQLs, $cacheArray;
 
        // Init arrays
        $SQLs = array(); $INC_POOL = array();
@@ -480,17 +448,15 @@ function EXTENSION_UPDATE ($file, $ext_name, $ext_ver, $dry_run=false) {
        // Only admins are allowed to update extensions
        if ((!IS_ADMIN()) || (empty($ext_name))) return false;
 
-       // Load extension in update mode
-       LOAD_EXTENSION($ext_name, "update". $ext_ver, $dry_run);
-
-       if (!empty($EXT_UPDATE_DEPENDS)) {
-               // Update another extension first!
-               $test = EXTENSION_UPDATE(("ext-".$EXT_UPDATE_DEPENDS.".php"), $EXT_UPDATE_DEPENDS, GET_EXT_VERSION($EXT_UPDATE_DEPENDS), $dry_run);
-       }
+       // Load extension in test mode
+       LOAD_EXTENSION($ext_name, "test", $ext_ver, $dry_run, $SQLs);
 
        // Save version history
        $history = $EXT_VER_HISTORY;
 
+       // Remove old SQLs array to prevent possible bugs
+       $SQLs = array();
+
        // Check if version is updated
        if ((($EXT_VERSION != $ext_ver) || ($dry_run)) && (is_array($history))) {
                // Search for starting point
@@ -499,74 +465,67 @@ function EXTENSION_UPDATE ($file, $ext_name, $ext_ver, $dry_run=false) {
 
                // And load SQL queries in order of version history
                for ($idx = ($start + 1); $idx < sizeof($history); $idx++) {
-                       // Remove old SQLs array to prevent possible bugs
-                       if (!$dry_run) { unset($SQLs); $SQLs = array(); }
-
                        // Set extension version
-                       $ver = $history[$idx];
+                       $cacheArray['update_ver'][$ext_name] = $history[$idx];
 
                        // Load again...
-                       LOAD_EXTENSION($ext_name, "update", $ver, $dry_run);
+                       LOAD_EXTENSION($ext_name, "update", $cacheArray['update_ver'][$ext_name], $dry_run, $SQLs);
+
+                       if (!empty($EXT_UPDATE_DEPENDS)) {
+                               // Backup current SQL queries
+                               $cacheArray['update_sqls'][$ext_name] = $SQLs;
+
+                               // Is the extension there?
+                               if (GET_EXT_VERSION($EXT_UPDATE_DEPENDS) != "") {
+                                       // Update another extension first!
+                                       $test = EXTENSION_UPDATE($EXT_UPDATE_DEPENDS, GET_EXT_VERSION($EXT_UPDATE_DEPENDS), $dry_run);
+                               } else {
+                                       // Register new extension
+                                       $test = EXTENSION_REGISTER($EXT_UPDATE_DEPENDS, 0, $dry_run, false);
+                               }
+
+                               // Restore previous SQL queries
+                               $SQLs = $cacheArray['update_sqls'][$ext_name];
+                               unset($cacheArray['update_sqls'][$ext_name]);
+                       } // END - if
 
                        // Add notes
                        if (getConfig('verbose_sql') == "Y") {
                                if (!empty($UPDATE_NOTES)) {
                                        // Update notes found
-                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$ver.":</strong><br />".$UPDATE_NOTES."</div>");
+                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$cacheArray['update_ver'][$ext_name].":</strong><br />".$UPDATE_NOTES."</div>");
                                        $UPDATE_NOTES = "";
-                               } elseif ($ver == "0.0") {
+                               } elseif ($cacheArray['update_ver'][$ext_name] == "0.0") {
                                        // Initial release
-                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$ver.":</strong><br />".INITIAL_RELEASE."</div>");
+                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$cacheArray['update_ver'][$ext_name].":</strong><br />".INITIAL_RELEASE."</div>");
                                } else {
-                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$ver.":</strong><br /><I>".NO_UPDATE_NOTES."</I></div>");
+                                       $NOTES .= ("<div class=\"update_notes\"><strong>v".$cacheArray['update_ver'][$ext_name].":</strong><br /><I>".NO_UPDATE_NOTES."</I></div>");
                                }
                        } // END - if
-
-                       // In real-mode execute any existing includes
-                       if ((!$dry_run) && (count($INC_POOL) > 0)) {
-                               // Include all files
-                               foreach ($INC_POOL as $fqfn) {
-                                       require_once($fqfn);
-                               } // END - foreach
-                       } // END - if
-
-                       // Run SQLs
-                       if ((is_array($SQLs)) && (!$dry_run)) {
-                               // Run SQL commands
-                               foreach ($SQLs as $sql)
-                               {
-                                       $sql = trim($sql);
-                                       if (!empty($sql))
-                                       {
-                                               // Do we have an "ALTER TABLE" command?
-                                               if (substr(strtolower($sql), 0, 11) == "alter table") {
-                                                       // Analyse the alteration command
-                                                       SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
-                                               } else {
-                                                       // Run regular SQL command
-                                                       $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
-                                               }
-                                       }
-                               }
-                       } elseif (GET_EXT_VERSION("sql_patches") == "") {
-                               // Remove SQLs if extension is not installed
-                               $SQLs = array();
-                       }
                } // END - for
 
+               // In real-mode execute any existing includes
                if (!$dry_run) {
-                       // In normal mode insert task and update extension's version...
-                       $ext_subj = "[UPDATE-".$ext_name."-".$EXT_VERSION.":] ".ADMIN_UPDATE_EXT_SUBJ;
+                       $cacheArray['inc_pool'][$ext_name] = $INC_POOL;
+                       RUN_FILTER('load_includes');
+                       $INC_POOL = $cacheArray['inc_pool'][$ext_name];
+                       unset($cacheArray['inc_pool'][$ext_name]);
+               } // END - if
 
+               // Run SQLs
+               RUN_FILTER('run_sqls', $dry_run);
+
+               if (!$dry_run) {
                        // Create task
-                       CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_subj, addslashes($NOTES));
+                       CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $cacheArray['update_ver'][$ext_name], addslashes($NOTES));
 
                        // 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_name), __FILE__, __LINE__);
+                               array($cacheArray['update_ver'][$ext_name], $ext_name), __FILE__, __LINE__);
 
-                       // Remove array
+                       // Remove arrays
                        unset($SQLs);
+                       unset($cacheArray['update_ver'][$ext_name]);
 
                        // Run filters on success extension update
                        RUN_FILTER('extension_update', $ext_name);
@@ -643,7 +602,7 @@ function GET_EXT_NAME ($ext_id) {
        $ret = "";
 
        // Is cache there?
-       if (!empty($cacheArray['extensions']['ext_name'][$ext_id])) {
+       if (isset($cacheArray['extensions']['ext_name'][$ext_id])) {
                // Load from cache
                $ret = $cacheArray['extensions']['ext_name'][$ext_id];
 
@@ -729,26 +688,25 @@ function EXT_VERSION_IS_OLDER ($ext_name, $ext_ver) {
 }
 
 // Creates a new task for updated extension
-function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
-       // Check if task is not there
-       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject='%s' LIMIT 1",
-               array($subject), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 0) {
-               // Task not created so it's a brand-new extension which we need to register and create a task for!
-               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
-                       array($admin_id, $subject, $notes), __FILE__, __LINE__);
+function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) {
+       // Create subject line
+       $subject = "[UPDATE-".$ext_name."-".$ext_ver.":] ".ADMIN_UPDATE_EXT_SUBJ;
+
+       // Is the extension there?
+       if (GET_EXT_VERSION($ext_name) != "") {
+               // Check if task is not there
+               if (DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) {
+                       // Task not created so it's a brand-new extension which we need to register and create a task for!
+                       SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
+                               array($admin_id, $subject, $notes), __FILE__, __LINE__);
+               } // END - if
        } // END - if
-
-       // Free memory
-       SQL_FREERESULT($result);
 }
 
 // Creates a new task for newly installed extension
 function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
        // Not installed and do we have created a task for the admin?
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
-               array($subject), __FILE__, __LINE__);
-       if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) == "")) {
+       if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == "")) {
                // Template file
                $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
                        PATH,
@@ -775,9 +733,6 @@ VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
                        ),  __FILE__, __LINE__, true, false
                );
        } // END - if
-
-       // Free memory
-       SQL_FREERESULT($result);
 }
 
 // Creates a task for automatically deactivated (deprecated) extension
@@ -786,9 +741,7 @@ function CREATE_EXTENSION_DEACTIVATION_TASK ($ext) {
        $subject = sprintf("[%s:] %s", $ext, TASK_SUBJ_EXTENSION_DEACTIVATED);
 
        // Not installed and do we have created a task for the admin?
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` = '%s' LIMIT 1",
-               array($subject), __FILE__, __LINE__);
-       if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) != "")) {
+       if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != "")) {
                // Task not created so add it
                $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
 VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())",
@@ -803,5 +756,99 @@ VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())",
        SQL_FREERESULT($result);
 }
 
+// Checks if the module has a menu
+function MODULE_HAS_MENU ($mod, $forceDb = false) {
+       global $cacheArray, $_CONFIG;
+
+       // All is false by default
+       $ret = false;
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
+       if (GET_EXT_VERSION("cache") >= "0.1.2") {
+               // Cache version is okay, so let's check the cache!
+               if (isset($cacheArray['modules']['has_menu'][$mod])) {
+                       // Check module cache and count hit
+                       $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
+                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
+                       // Check cache and count hit
+                       $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
+                       if (getConfig('cache_hits') > 0) { $_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__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Load "has_menu" column
+                       list($has_menu) = SQL_FETCHROW($result);
+
+                       // Fake cache... ;-)
+                       $cacheArray['extensions']['ext_menu'][$mod] = $has_menu;
+
+                       // Does it have a menu?
+                       $ret = ($has_menu == "Y");
+               } // END  - if
+
+               // Free memory
+               SQL_FREERESULT($result);
+       } elseif (GET_EXT_VERSION("sql_patches") == "") {
+               // No sql_patches installed, so maybe in admin area?
+               $ret = ((IS_ADMIN()) && ($mod == "admin")); // Then there is a menu!
+       }
+
+       // Return status
+       //* DEBUG: */ var_dump($ret);
+       return $ret;
+}
+
+// Determines the task id for given extension
+function DETERMINE_EXTENSION_TASK_ID ($ext_name) {
+       // Default is not found
+       $task_id = 0;
+
+       // Search for extension task's id
+       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
+               array($ext_name), __FILE__, __LINE__);
+
+       // Entry found?
+       if (SQL_NUMROWS($result) == 1) {
+               // Task found so load task's ID and register extension...
+               list($task_id) = SQL_FETCHROW($result);
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return it
+       return $task_id;
+}
+
+// Determines the task id for given subject
+function DETERMINE_TASK_ID_BY_SUBJECT ($subject) {
+       // Default is not found
+       $task_id = 0;
+
+       // Search for task id
+       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '%s%%' LIMIT 1",
+               array($subject), __FILE__, __LINE__);
+
+       // Entry found?
+       if (SQL_NUMROWS($result) == 1) {
+               // Task found so load task's ID and register extension...
+               list($task_id) = SQL_FETCHROW($result);
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return it
+       return $task_id;
+}
+
 //
 ?>
index 211c57e7e99e3ce73249d181f5a1664b0a04b5ea..d5d1972d331459054b5ffbe42e5e1db18c6b9901 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version of this extension
-$EXT_VERSION = "0.7.0";
+$EXT_VERSION = "0.7.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.1", "0.2", "0.3", "0.3.1", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0");
+$EXT_VER_HISTORY = array("0.0", "0.1", "0.2", "0.3", "0.3.1", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0", "0.7.1");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -57,10 +57,13 @@ 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 action='admins' LIMIT 5";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='admins' LIMIT 6";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_acls";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_mails";
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP default_acl";
+
+       // Remove filters
+       UNREGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', true, !$dry_run);
        break;
 
 case "activate": // Do stuff when admin activates this extension
@@ -282,6 +285,17 @@ PRIMARY KEY (id)
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Fehlgeschlagene Login-Versuche werden nun mitgez&auml;hlt und der letzte vermerkt.";
                break;
+
+       case "0.7.1": // SQL queries for v0.7.1
+               // Update depends on sql_patches
+               $EXT_UPDATE_DEPENDS = "sql_patches";
+
+               // Add filters
+               REGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', false, true, !$dry_run);
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Filter hinzugef&uuml;gt und ist von <strong>sql_patches</strong> abh&auml;ngig.";
+               break;
        }
        break;
 
index 41e689a336159c22cb61d00e52f5ff4192e6fbbf..de4d83ef1567bdcf42799df01e0ab591f2a3732f 100644 (file)
@@ -39,13 +39,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.2.1";
+$EXT_VERSION = "0.2.2";
 
 // 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", "0.2.1");
+$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");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -64,7 +64,9 @@ case "remove": // Do stuff when removing extension
        // Unregister all filters
        UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, !$dry_run);
        UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, !$dry_run);
+       UNREGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', true, !$dry_run);
        UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, !$dry_run);
+       UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', true, !$dry_run);
        UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
        UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
        UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
@@ -212,17 +214,26 @@ case "update": // Update an extension
 
        case "0.2.1": // SQL queries for v0.2.1
                // Register the new filter
-               REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
-               REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
-               REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
-               REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
-               REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
-               REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
-               REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
-               REGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', false, true);
+               REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
+               REGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', false, true, !$dry_run);
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Filter hinzugef&uuml;gt f&uuml;r Erweiterungsmanagement.";
+               $UPDATE_NOTES = "Filter f&uuml;r Erweiterungsmanagement hinzugef&uuml;gt.";
+               break;
+
+       case "0.2.2": // SQL queries for v0.2.2
+               // Register the new filter
+               REGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', false, true, !$dry_run);
+               REGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', false, true, !$dry_run);
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Weitere Filter hinzugef&uuml;gt.";
                break;
        }
        break;
diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php
new file mode 100644 (file)
index 0000000..67d04e4
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 12/18/2008 *
+ * ================                             Last change: 12/18/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : ext-network.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Generic (sponsor) network connection extension   *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Allgemeine Sponsornetzwerk Erweiterung           *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * 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);
+}
+
+// Version number
+$EXT_VERSION = "0.0";
+
+// 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");
+
+switch ($EXT_LOAD_MODE)
+{
+case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
+       // SQL commands to run
+       break;
+
+case "remove": // Do stuff when removing extension
+       // SQL commands to run
+       break;
+
+case "activate": // Do stuff when admin activates this extension
+       // SQL commands to run
+       break;
+
+case "deactivate": // Do stuff when admin deactivates this extension
+       // SQL commands to run
+       break;
+
+case "update": // Update an extension
+       switch ($EXT_VER)
+       {
+       case "0.0.1": // SQL queries for v0.0.1
+               $SQLs[] = "";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "";
+               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 2f12e45136607687aaa29f1e7e8e5ac0311b06d3..a765bdd1cbdf3604fe1fd22865eec7883b3f7665 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.3.4";
+$EXT_VERSION = "0.3.5";
 
 // 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", "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");
+$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");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -86,25 +86,33 @@ KEY (rallye_id),
 KEY (userid),
 PRIMARY KEY(id)
 ) TYPE=MyISAM";
+
        // Admin menu
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('rallye', NULL, 'Rallye-Management','Richten Sie neue Ref-Rallyes ein, die zeitgesteuert anfangen und aufh&ouml;hren. Dabei wird alles weitere automatisch geregelt.','9')";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('rallye','add_rallye','Neue Rallye hinzuf&uuml;gen','Neue Ref-Rallye hinzuf&uuml;gen.','1')";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('rallye','config_rallye_prices','Preise einrichten','Richten Sie Preise zu den Rallyes ein.','2')";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('rallye','list_rallyes','Rallyes verwalten','Alle bestehenden Ref-Rallyes auflisten, bearbeiten, stoppen, l&ouml;schen usw.','3')";
+
        // Guest menu
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','rallyes','Ref-Rallyes','Y','Y','9')";
+
        // Member menu
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','rallyes','Ref-Rallyes','Y','Y','9')";
        break;
 
 case "remove": // Do stuff when removing extension
-       // SQL commands to run
+       // Drop tables
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_rallye_data";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_rallye_prices";
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_rallye_users";
+
+       // Remove menus
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='rallye' LIMIT 4";
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE what='rallyes' LIMIT 1";
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE what='rallyes' LIMIT 1";
+
+       // Unregister filter
+       UNREGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', true, !$dry_run);
        break;
 
 case "activate": // Do stuff when admin activates this extension
@@ -297,6 +305,17 @@ Zudem sollten Sie mindestens folgende Templates (in <STRONG>templates/".GET_LANG
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
                break;
+
+       case "0.3.5": // SQL queries for 0.3.5
+               // This update depends on sql_patches
+               $EXT_UPDATE_DEPENDS = "sql_patches";
+
+               // Register filter
+               REGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', false, true, !$dry_run);
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Filter hinzugef&uuml;gt und ist von <strong>sql_patches</strong> abh&auml;ngig.";
+               break;
        }
        break;
 
index f60423146408fcc03d5390679ca4fdabcee96cbe..5e0556ae7f6c6f51778d77bd94ea43ec38d735a9 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.0";
+$EXT_VERSION = "0.0.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");
+$EXT_VER_HISTORY = array("0.0", "0.0.1");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -65,6 +65,9 @@ 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_removeip' LIMIT 1";
+
+       // Remove filters
+       UNREGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', true, !$dry_run);
        break;
 
 case "activate": // Do stuff when admin activates this extension
@@ -79,10 +82,14 @@ case "update": // Update an extension
        switch ($EXT_VER)
        {
        case "0.0.1": // SQL queries for v0.0.1
-               $SQLs[] = "";
+               // Update depends on sql_patches
+               $EXT_UPDATE_DEPENDS = "sql_patches";
+
+               // Add filters
+               REGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', false, true, !$dry_run);
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "";
+               $UPDATE_NOTES = "Filter hinzugef&uuml;gt und ist von <strong>sql_patches</strong> abh&auml;ngig.";
                break;
        }
        break;
index f869145137e73f37af8d49ef346b5aaba6c3e094..1d10934a85956e489e794dd215b345ef94ba60a2 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version number
-$EXT_VERSION = "0.5.9";
+$EXT_VERSION = "0.6.0";
 
 // Auto-set extension version
 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -702,6 +702,14 @@ PRIMARY KEY (`filter_id`)
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Tabellen f&uuml;r Filter-System hinzugef&uuml;gt.";
                break;
+
+       case "0.6.0": // SQL queries for v0.6.0
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_filters` ADD `filter_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `update_filter_usage` ENUM('N','Y') NOT NULL DEFAULT 'N'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Benutzungsstatistik eingebaut. Das Z&auml;hlen der Filterverwendungen sollte <strong>ausschliesslich</strong> zu Debugging-Zwecken eingesetzt werden.";
+               break;
        }
        break;
 
index efd94b263013d567fb20ab410df94271c82b68e6..c0b3702d2eb191ac615e61dbe32cfccedb6f7f63 100644 (file)
@@ -39,7 +39,7 @@ if (!defined('__SECURITY')) {
 
 // Init "generic filter system"
 function INIT_FILTER_SYSTEM() {
-       global $filters, $loadedFilters;
+       global $filters, $loadedFilters, $counter;
 
        // Is the filter already initialized?
        if ((isset($filters)) && (is_array($filters))) {
@@ -58,13 +58,18 @@ function INIT_FILTER_SYSTEM() {
                'shutdown'  => array()
        );
 
-       // Init loaded filters
+       // Init loaded filters and counter
        $loadedFilters =  array();
+       $counter = array();
 
        // Load all saved filers if sql_patches is updated
        if (GET_EXT_VERSION("sql_patches") >= "0.5.9") {
+               // Init add
+               $ADD = "";
+               if (GET_EXT_VERSION("sql_patches") >= "0.6.0") $ADD = ", `filter_counter`";
+
                // Load all active filers
-               $result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active`
+               $result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active`".$ADD."
 FROM `"._MYSQL_PREFIX."_filters`
 ORDER BY `filter_id` ASC", __FILE__, __LINE__);
 
@@ -72,11 +77,24 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Load all filters
                        while ($filterArray = SQL_FETCHARRAY($result)) {
+                               // Get filter name and function
+                               $filterName     = $filterArray['filter_name'];
+                               $filterFunction = $filterArray['filter_function'];
+
+                               // Set counter to default
+                               $counter[$filterName][$filterFunction] = 0;
+
                                // Mark this filter as loaded (from database)
-                               $loadedFilters[$filterArray['filter_name']][$filterArray['filter_function']] = true;
+                               $loadedFilters[$filterName][$filterFunction] = true;
 
                                // Set this filter
-                               $filters[$filterArray['filter_name']][$filterArray['filter_function']] = $filterArray['filter_active'];
+                               $filters[$filterName][$filterFunction] = $filterArray['filter_active'];
+
+                               // Is the array element for counter there?
+                               if (isset($filterArray['filter_counter'])) {
+                                       // Then use this value!
+                                       $counter[$filterName][$filterFunction] = $filterArray['filter_counter'];
+                               } // END - if
                        } // END - while
                } // END - if
        
@@ -84,16 +102,33 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
                SQL_FREERESULT($result);
        } // END - if
 
-       // @TODO Find some more init/shutdown filter functions
+       // Login failtures handler
+       REGISTER_FILTER('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
+
+       // Filters for pre-extension-registration
+       REGISTER_FILTER('pre_extension_installed', 'RUN_SQLS');
+
+       // Filters for post-extension-registration
+       REGISTER_FILTER('post_extension_installed', 'AUTO_ACTIVATE_EXTENSION');
+       REGISTER_FILTER('post_extension_installed', 'SOLVE_TASK');
+       REGISTER_FILTER('post_extension_installed', 'LOAD_INCLUDES');
+
+       // Solving tasks
+       REGISTER_FILTER('solve_task', 'SOLVE_TASK');
+
+       // Loading includes in general
+       REGISTER_FILTER('load_includes', 'LOAD_INCLUDES');
+
+       // Run SQLs
+       REGISTER_FILTER('run_sqls', 'RUN_SQLS');
 
        // 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, $force = false) {
-       global $filters;
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $add = true) {
+       global $filters, $counter;
 
        // Extend the filter function name
        $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
@@ -116,13 +151,17 @@ function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $fo
                return false;
        } // END - if
 
-       // Simply add it to the array
-       $filters[$filterName][$filterFunction] = "Y";
+       // Shall we add it?
+       if ($add) {
+               // Simply add it to the array
+               $filters[$filterName][$filterFunction] = "Y";
+               $counter[$filterName][$filterFunction] = 0;
+       } // END - if
 }
 
 // "Unregisters" a filter from the given chain
 function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $remove = true) {
-       global $filters;
+       global $filters, $counter;
 
        // Extend the filter function name
        $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
@@ -138,12 +177,13 @@ function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $remov
        if ($remove) {
                // Mark for filter removal
                $filters[$filterName][$filterFunction] = "R";
+               unset($counter[$filterName][$filterFunction]);
        } // END  - if
 }
 
 // "Runs" the given filters, data is optional and can be any type of data
 function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
-       global $filters;
+       global $filters, $counter;
 
        // Is that filter chain there?
        if (!isset($filters[$filterName])) {
@@ -167,8 +207,20 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
 
                // Is the filter active?
                if ($active == "Y") {
+                       // Is this filter there?
+                       if (!function_exists($filterFunction)) {
+                               // Unregister it
+                               UNREGISTER_FILTER($filterName, $filterFunction);
+
+                               // Skip this entry
+                               continue;
+                       } // END - if
+
                        // Call the filter chain
                        $returnValue = call_user_func_array($filterFunction, array($returnValue));
+
+                       // Update usage counter
+                       $counter[$filterName][$filterFunction]++;
                } // END - if
        } // END - foreach
 
@@ -182,7 +234,10 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
 
 // Filter for flushing all new filters to the database
 function FILTER_FLUSH_FILTERS () {
-       global $filters, $link, $loadedFilters;
+       global $filters, $counter, $link, $loadedFilters, $SQLs;
+
+       // Clear all previous SQL queries
+       $SQLs = array();
 
        // Is a database link here and not in installation mode?
        if ((!is_resource($link)) && (!isBooleanConstantAndTrue('mxchange_installing'))) {
@@ -227,7 +282,7 @@ function FILTER_FLUSH_FILTERS () {
                $insertSQL = substr($insertSQL, 0, -1);
 
                // And run it
-               SQL_QUERY($insertSQL, __FILE__, __LINE__);
+               $SQLs[] = $insertSQL;
        } // END - if
 
        // Something has been removed?
@@ -236,20 +291,142 @@ function FILTER_FLUSH_FILTERS () {
                $removeSQL = substr($removeSQL, 0, -2) . "LIMIT ".$removed;
 
                // And run it
-               SQL_QUERY($removeSQL, __FILE__, __LINE__);
+               $removeSQL;
+       } // END - if
+
+       // Shall we update usage counters (ONLY FOR DEBUGGING!)
+       if (getConfig('update_filter_usage') == "Y") {
+               // Update all counters
+               foreach ($counter as $filterName => $filterArray) {
+                       // Walk through all filters
+                       foreach ($filterArray as $filterFunction => $cnt) {
+                               // Construct and add the query
+                               $SQLs[] = sprintf("UPDATE `"._MYSQL_PREFIX."_filters` SET `filter_counter`=%s WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT 1",
+                                       bigintval($cnt),
+                                       $filterName,
+                                       $filterFunction
+                               );
+                       } // END - foreach
+               } // END - foreach
+       } // END - if
+
+       // Run the run_sqls filter in non-dry mode
+       RUN_FILTER('run_sqls', false);
+}
+
+// Filter for calling the handler for login failtures
+function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) {
+       // Init content
+       $content = $data;
+
+       // Handle failed logins here if not in guest
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$data['type']},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$data['access_level']}<br />\n";
+       if ((($data['type'] == "what") || ($data['type'] == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == getConfig('index_home')))) && ($data['access_level'] != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
+               // Handle failture
+               $content['content'] .= HANDLE_LOGIN_FAILTURES($data['access_level']);
        } // END - if
+
+       // Return the content
+       return $content;
 }
 
-// Filter for shutting down the database link
-function FILTER_SHUTDOWN_DATABASE () {
-       global $link;
+// Filter for redirecting to logout if sql_patches has been installed
+function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
+       // Remove this filter
+       UNREGISTER_FILTER('shutdown', __FUNCTION__);
 
-       if (is_resource($link)) {
-               // Close link
-               SQL_CLOSE($link, __FILE__, __LINE__);
-       } else {
-               // No database link
-               ADD_FATAL(NO_DB_LINK);
+       // Is the element set?
+       if (isset($GLOBALS['ext_load_mode'])) {
+               // Redirect here
+               LOAD_URL("modules.php?module=admin&logout=1&".$GLOBALS['ext_load_mode']."=sql_patches");
+       } // END - if
+
+       // This should not happen!
+       DEBUG_LOG(__FUNCTION__, __LINE__, "Cannot auto-logout because no extension load-mode has been set.");
+}
+
+// Filter for auto-activation of a extension
+function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
+       global $EXT_ALWAYS_ACTIVE;
+
+       // Is this extension always activated?
+       if ($EXT_ALWAYS_ACTIVE == "Y") {
+               // Then activate the extension
+               //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ext_name={$data['ext_name']}<br />\n";
+               ACTIVATE_EXTENSION($data['ext_name']);
+       } // END - if
+
+       // Return the data
+       return $data;
+}
+
+// Filter for solving task given task
+function FILTER_SOLVE_TASK ($data) {
+       // Don't solve anything if no admin!
+       if (!IS_ADMIN()) return $data;
+
+       // Is this a direct task id or array element task_id is found?
+       if (is_int($data)) {
+               // Then solve it...
+               ADMIN_SOLVE_TASK($data);
+       } elseif ((is_array($data)) && (isset($data['task_id']))) {
+               // Solve it...
+               ADMIN_SOLVE_TASK($data['task_id']);
+       }
+
+       // Return the data
+       return $data;
+}
+
+// Filter to load include files
+function FILTER_LOAD_INCLUDES ($data) {
+       global $INC_POOL;
+
+       // Is it an array?
+       if ((!isset($INC_POOL)) || (!is_array($INC_POOL))) {
+               // Then abort here
+               DEBUG_LOG(__FILE__, __LINE__, "INC_POOL is no array!");
+               return $data;
+       } // END - if
+
+       // Check for added include files
+       if (count($INC_POOL) > 0) {
+               // Loads every include file
+               foreach ($INC_POOL as $fqfn) {
+                       require_once($fqfn);
+               } // END - foreach
+
+               // Remove array
+               unset($INC_POOL);
+       } // END - if
+
+       // Return $data
+       return $data;
+}
+
+// Filter for running SQL commands
+function FILTER_RUN_SQLS ($dry_run) {
+       global $SQLs;
+
+       // Is the array there?
+       if ((is_array($SQLs)) && (!$dry_run)) {
+               // Run SQL commands
+               foreach ($SQLs as $sql) {
+                       $sql = trim($sql);
+                       if (!empty($sql)) {
+                               // Do we have an "ALTER TABLE" command?
+                               if (substr(strtolower($sql), 0, 11) == "alter table") {
+                                       // Analyse the alteration command
+                                       SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
+                               } else {
+                                       // Run regular SQL command
+                                       $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
+                               }
+                       } // END - if
+               } // END - foreach
+       } elseif (GET_EXT_VERSION("sql_patches") == "") {
+               // Remove SQLs if extension is not installed
+               $SQLs = array();
        }
 }
 
index 992c4a7373af6cc475fd21b82865921d640073eb..999c6e8e64c792af404dce3b14196a2a5f5fe32d 100644 (file)
@@ -239,6 +239,11 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
                $_CONFIG['num_templates']++;
        }
 
+       // Prepare IP number and User Agent
+       $REMOTE_ADDR     = GET_REMOTE_ADDR();
+       if (!defined('REMOTE_ADDR')) define('REMOTE_ADDR', $REMOTE_ADDR);
+       $HTTP_USER_AGENT = GET_USER_AGENT();
+
        // Init some data
        $ret = "";
        if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = 0;
@@ -2824,7 +2829,7 @@ function DETERMINE_REFID () {
 }
 
 // Destroys the admin session
-function DESTROY_ADMIN_SESSION () {
+function DESTROY_ADMIN_SESSION ($destroy = true) {
        // Kill maybe existing session variables including array elements
        set_session('admin_login', "");
        set_session('admin_md5'  , "");
@@ -2832,7 +2837,12 @@ function DESTROY_ADMIN_SESSION () {
        set_session('admin_to'   , "");
 
        // Destroy session and return status
-       return @session_destroy();
+       if ($destroy) {
+               return @session_destroy();
+       } // END - if
+
+       // All fine if we shall not really destroy the session
+       return true;
 }
 
 // Checks if a given apache module is loaded
index 745befbddfec34555cce0e4fd33bcf3dccd392d4..74ecd9dcb7f10986e5a8293d7115c4166391923c 100644 (file)
@@ -846,7 +846,7 @@ define('SORT_NAVIGATION', "Sortieren");
 define('HIGHER', "H&ouml;her");
 define('LOWER', "Niedriger");
 define('MEMBER_SETTINGS_SAVED', "Einstellungen gespeichert.");
-define('REMOTE_ADDR_TIMEOUT', "Ein Mitglied ist mit Ihrer IP-Nummer <U>".GET_REMOTE_ADDR()."</U> bereits registriert! Bitte kontaktieren Sie uns, wenn dies ein Fehler sein sollte!");
+define('REMOTE_ADDR_TIMEOUT', "Ein Mitglied ist mit Ihrer IP-Nummer <U>{!REMOTE_ADDR!}</U> bereits registriert! Bitte kontaktieren Sie uns, wenn dies ein Fehler sein sollte!");
 define('IP_TIMEOUT', "IP-Zeitsperre");
 define('ADMIN_PAYOUT_NOT_INSTALLED', "payout-Erweiterung nicht installiert!");
 define('ADMIN_WERNIS_NOT_INSTALLED', "wernis-Erweiterung nicht installiert!");
index ed611425249a92c3acde377d3c91ca806ad97d38..0ccb9e1fbe5a9b572df7504164ed9b90b0936522 100644 (file)
@@ -537,7 +537,7 @@ define('SORT_NAVIGATION', "Sortieren");
 define('HIGHER', "H&ouml;her");
 define('LOWER', "Niedriger");
 define('MEMBER_SETTINGS_SAVED', "Einstellungen gespeichert.");
-define('REMOTE_ADDR_TIMEOUT', "Ein Mitglied ist mit Ihrer IP-Nummer <U>".GET_REMOTE_ADDR()."</U> bereits registriert! Bitte kontaktieren Sie uns, wenn dies ein Fehler sein sollte!");
+define('REMOTE_ADDR_TIMEOUT', "Ein Mitglied ist mit Ihrer IP-Nummer <U>{!REMOTE_ADDR!}</U> bereits registriert! Bitte kontaktieren Sie uns, wenn dies ein Fehler sein sollte!");
 define('IP_TIMEOUT', "IP-Zeitsperre");
 define('ADMIN_PAYOUT_NOT_INSTALLED', "payout-Erweiterung nicht installiert!");
 define('ADMIN_ADD_MAX_VALUE', "Neuen Maximal-Wert hinzuf&uuml;gen");
index c4e0045a010e091994010a52b03386074bcbde20..05e121443d6f47f43a5b197b06bc1e3da185005e 100644 (file)
@@ -395,5 +395,19 @@ function ADMINS_LIST_ADMIN_ACCOUNTS() {
        LOAD_TEMPLATE("admin_list_admins");
 }
 
+// Filter for adding extra data to the query
+function FILTER_ADD_EXTRA_SQL_DATA () {
+       // Init extra data
+       $ADD = "";
+
+       // Is the admins extension updated? (should be!)
+       if (GET_EXT_VERSION("admins") >= "0.3")   $ADD .= ", default_acl AS def_acl";
+       if (GET_EXT_VERSION("admins") >= "0.6.7") $ADD .= ", la_mode";
+       if (GET_EXT_VERSION("admins") >= "0.7.0") $ADD .= ", login_failtures, UNIX_TIMESTAMP(last_failture) AS last_failture";
+
+       // Return it
+       return $ADD;
+}
+
 //
 ?>
index 15adc4680619d683518bb041cddce11807b4e788..1c083863ec2e13a7dbf75d5f71d2148d5becaacd 100644 (file)
@@ -397,22 +397,25 @@ class CacheSystem {
 }
 
 // Destroy the cache on extension changes
-function FILTER_CACHE_DESTROY_ON_EXT_CHANGE () {
+function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
        global $cacheInstance;
 
-       // Update cache
+       // Remove cache
        if (EXT_IS_ACTIVE("cache")) {
                if ($cacheInstance->loadCacheFile("config"))     $cacheInstance->destroyCacheFile();
                if ($cacheInstance->loadCacheFile("extensions")) $cacheInstance->destroyCacheFile();
                if ($cacheInstance->loadCacheFile("mod_reg"))    $cacheInstance->destroyCacheFile();
        } // END - if
+
+       // Return it
+       return $DATA;
 }
 
 // Destroy the cache on changing admin
 function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
        global $cacheInstance;
 
-       // Update cache
+       // Remove cache
        if (EXT_IS_ACTIVE("cache")) {
                if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
        } // END - if
@@ -434,5 +437,11 @@ function FILTER_CACHE_DESTROY_ALL () {
        } // END - if
 }
 
+// Filter for purging entire admin menu cache
+function FILTER_CACHE_PURGE_ADMIN_MENU () {
+       // Just call the function
+       CACHE_PURGE_ADMIN_MENU();
+}
+
 //
 ?>
index b3da615f011855d1d912a81707bd71a34b910b61..255bca49bb76d12d43efbc207112c9b336876e1d 100644 (file)
@@ -802,5 +802,12 @@ WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FILE__, __LINE__);
        //* DEBUG: */ echo "*".$uid."/".$old."/".$cnt."*<br />";
        return $cnt;
 }
+
+// Filter for extra-autpurge
+function FILTER_RALLYE_EXTRA_AUTOPURGE () {
+       // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
+       RALLYE_DELETE_EXPIRED_RALLYES();
+}
+
 //
 ?>
index c437e29dd236834c4cc2be5093fa3e3f17b133d7..85722cdad7cc8fbc1946ce543e46154ea480a357 100644 (file)
@@ -192,7 +192,7 @@ function UPDATE_REFBACK_TABLE($uid) {
 
                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]}<br />\n";
                        // Refid set?
-                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (!empty($cacheArray['up_refid'][$cacheArray['back_level']]))) {
+                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (isset($cacheArray['up_refid'][$cacheArray['back_level']]))) {
                                // New userid?
                                if ((isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) && (isset($cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]]))) {
                                        // New userid!
index e3b69e9e8b0a34cbffebf638a538d4ae684f0ef2..bd09d69ee56a087bf5349749ea4c046ed48275bb 100644 (file)
@@ -140,5 +140,20 @@ function REMOVEIP_ADD_INFOS () {
        return LOAD_TEMPLATE("removeip_level", true, $message);
 }
 
+// Filter for adding anonymity notice to the output stream
+function FILTER_ADD_ANONYMITY_NOTICE ($data) {
+       // Init content
+       $content = $data;
+
+       // Extension removeip activated?
+       if ((EXT_IS_ACTIVE("removeip")) && (getConfig('removeip_'.strtolower($data['access_level']).'_show') == "Y")) {
+               // Add anoymity/privacy infos
+               $content['content'] .= REMOVEIP_ADD_INFOS()."<br />\n";
+       } // END - if
+
+       // Return it
+       return $content;
+}
+
 //
 ?>
index fad1bdde22d6912a7c3740fb78e8984210b66e9b..3039a408d1fe349dd9fd9995365058fc785ae3a1 100644 (file)
@@ -40,14 +40,8 @@ if (!defined('__SECURITY')) {
 // Load more cache includes
 $INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/loader/", "load_cache-");
 
-// Include all
-foreach ($INC_POOL as $fqfn) {
-       // Include the file
-       require_once($fqfn);
-} // END - foreach
-
-// Remove array
-unset($INC_POOL);
+// Run the filter
+RUN_FILTER('load_includes');
 
 //
 ?>
index 8a8c883826a223c309a3025244237003fb15229e..7ec8ecc44f4a81046218db101cfbb23b069a4e75 100644 (file)
@@ -262,15 +262,8 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1")
        SQL_FREERESULT($res_ext_crt);
 } // END - if
 
-// Load include files if found
-if (!empty($INC_POOL[0])) {
-       foreach ($INC_POOL as $inc) {
-               require_once($inc);
-       } // END - foreach
-
-       // Remove array
-       unset($INC_POOL);
-} // END - if
+// Run the filter
+RUN_FILTER('load_includes');
 
 // Uninstall extensions that are no longer in our system
 if (!empty($DEL[0])) {
@@ -281,7 +274,7 @@ if (!empty($DEL[0])) {
                        array($del_ext), __FILE__, __LINE__);
 
                // Remove (maybe?) found tasks (main task and possible updates
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:]%%' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject='[%s:]' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
                        array($del_ext), __FILE__, __LINE__);
        } // END - foreach
 
index d55aa09f1bc2fabc4b6c6d36dfbb2982ff74d3f8..9dd80220d7a6834592d32c6a200887b228ba8a85 100644 (file)
@@ -86,10 +86,7 @@ if (($cacheInstance->loadCacheFile("admins")) && ($cacheInstance->extensionVersi
        $cacheInstance->storeExtensionVersion("admins");
 
        // Load every data from DB to cache file
-       $ADD = ", id, id";
-       if (GET_EXT_VERSION("admins") >= "0.3")   $ADD  = ", default_acl AS def_acl";
-       if (GET_EXT_VERSION("admins") >= "0.6.7") $ADD .= ", la_mode";
-       if (GET_EXT_VERSION("admins") >= "0.7.0") $ADD .= ", login_failtures, UNIX_TIMESTAMP(last_failture) AS last_failture";
+       $ADD = RUN_FILTER('sql_admin_extra_data');
 
        // Query the database about this
        $result_admins = SQL_QUERY("SELECT id AS aid, login, password, email".$ADD."
index 517219f898a7afb431ffb754e7c732651e961d1a..cccd51af5adeb4efed3c25cc53f7045cdf09e239 100644 (file)
@@ -57,10 +57,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                $hashedPass = md5($_POST['pass']);
 
                // Kill maybe existing session variables
-               set_session('admin_login'       , "");
-               set_session('admin_md5'         , "");
-               set_session('admin_last'        , "");
-               set_session('admin_to'          , "");
+               DESTROY_ADMIN_SESSION(false);
 
                // Do registration
                $ret = REGISTER_ADMIN($_POST['login'], $hashedPass);
index 9ac190ce3747de34f9ab11b231a5dc720f0ec1c2..9aa13b1b54c04609bea2cb6cb428ac9bf8c63b9a 100644 (file)
@@ -61,15 +61,17 @@ function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER)
 function CHECK_ADMIN_LOGIN ($admin_login, $password) {
        global $cacheArray, $_CONFIG, $cacheInstance;
 
-       // Init variables
+       // By default no admin is found
        $ret = "404";
-       $data = array();
 
        // Get admin id
        $aid = GET_ADMIN_ID($admin_login);
 
+       // Init array with admin id by default
+       $data = array('aid' => $aid);
+
        // Is the cache valid?
-       if (!empty($cacheArray['admins']['password'][$aid])) {
+       if (isset($cacheArray['admins']['password'][$aid])) {
                // Get password from cache
                $data['password'] = $cacheArray['admins']['password'][$aid];
                $ret = "pass";
@@ -82,15 +84,14 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
                        $data['last_failture']   = $cacheArray['admins']['last_failture'][$aid];
                } // END - if
        } elseif (!EXT_IS_ACTIVE("cache")) {
-               $ADD = "";
-               if (GET_EXT_VERSION("admins") >= "0.7.0") {
-                       // Load them here
-                       $ADD = ", login_failtures, UNIX_TIMESTAMP(last_failture) AS last_failture";
-               } // END - if
+               // Add extra data via filter now
+               $ADD = RUN_FILTER('sql_admin_extra_data');
 
                // Get password from DB
                $result = SQL_QUERY_ESC("SELECT password".$ADD." FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
-                array($aid), __FILE__, __LINE__);
+                       array($aid), __FILE__, __LINE__);
+
+               // Entry found?
                if (SQL_NUMROWS($result) == 1) {
                        // Login password found
                        $ret = "pass";
index e8a2b36674321af689b7c92c3c35c9ba2c9f2c08..5574b354e4b79b9282f954d4bbefac594eeb2f4a 100644 (file)
@@ -55,60 +55,40 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
                if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
                        //* DEBUG: */ echo $file."<br />\n";
                        // Possible newly installed extension found so we extract extension's name
-                       $ext = strtolower(substr($file, 4, -4)); // Keep always extension names on lower case!!!
+                       $ext_name = strtolower(substr($file, 4, -4)); // Keep always extension names on lower case!!!
 
                        // Init variables
-                       $ext_ver = "";
                        $result = false;
 
                        // Check if extension is installed or not
-                       if ((is_array($cacheArray['extensions']['ext_version'])) && (isset($cacheArray['extensions']['ext_version'][$ext]))) {
-                               // Load version from cache
-                               if (!empty($cacheArray['extensions']['ext_version'][$ext])) {
-                                       // Extension is installed so we can get it's version number
-                                       $ext_ver = $cacheArray['extensions']['ext_version'][$ext];
-                               } else {
-                                       // Extension is not installed so no version number was found
-                                       $ext_ver = "";
-                               }
-                       } elseif (!EXT_IS_ACTIVE("cache")) {
-                               // Load data from database
-                               $result = SQL_QUERY_ESC("SELECT id, ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
-                                       array($ext), __FILE__, __LINE__);
-                       }
+                       $ext_ver = GET_EXT_VERSION($ext_name);
 
                        // Is the extension not yet installed?
-                       if ((SQL_NUMROWS($result) == 0) && (empty($ext_ver))) {
+                       if (empty($ext_ver)) {
                                // Generate subject line
-                               $ext_subj = sprintf("[%s:]", $ext);
+                               $ext_subj = sprintf("[%s:]", $ext_name);
 
                                // We maybe want to install an extension so let's test-drive it...
-                               if (LOAD_EXTENSION($ext, $EXT_LOAD_MODE)) {
+                               if (LOAD_EXTENSION($ext_name, $EXT_LOAD_MODE)) {
                                        // Create a task for newly installed extension
-                                       CREATE_NEW_EXTENSION_TASK(GET_CURRENT_ADMIN_ID(), $ext_subj, $ext);
+                                       CREATE_NEW_EXTENSION_TASK(GET_CURRENT_ADMIN_ID(), $ext_subj, $ext_name);
                                } // END - if
                        } else {
-                               // Maybe we want to update?
-                               if ((empty($cacheArray['extensions']['ext_version'][$ext])) && (SQL_NUMROWS($result) == 1)) {
-                                       list($dummy, $ext_ver) = SQL_FETCHROW($result);
-                                       SQL_FREERESULT($result);
-                               } // END - if
-
                                // Test-drive extension in update mode
-                               include(sprintf("%sinc/extensions/ext-%s.php", PATH, $ext));
-                               
+                               include(sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name));
+
                                // Update extension if extension is installed and outdated
-                               //* DEBUG: */ print "ext={$ext},ver={$EXT_VERSION}/".GET_EXT_VERSION($ext)."<br />\n";
-                               if ($EXT_VERSION > GET_EXT_VERSION($ext)) {
+                               //* DEBUG: */ print "ext={$ext_name},ver={$EXT_VERSION}/".GET_EXT_VERSION($ext_name)."<br />\n";
+                               if ($EXT_VERSION > $ext_ver) {
                                        // Update the extension
-                                       EXTENSION_UPDATE($file, $ext, $ext_ver);
+                                       EXTENSION_UPDATE($ext_name, $ext_ver);
                                } // END - if
 
-                               if (!empty($cacheArray['active_extensions'][$ext])) {
+                               if (isset($cacheArray['active_extensions'][$ext_name])) {
                                        // Maybe we want to keept the current extension active?
-                                       if (($cacheArray['active_extensions'][$ext] == "Y") && (!EXT_IS_ACTIVE($ext))) {
+                                       if (($cacheArray['active_extensions'][$ext_name] == "Y") && (!EXT_IS_ACTIVE($ext_name))) {
                                                // Reactivate this extension!
-                                               ACTIVATE_EXTENSION($ext);
+                                               ACTIVATE_EXTENSION($ext_name);
                                        } // END - if
                                } // END - if
                        }
@@ -205,7 +185,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                                $ext_ver = substr($ext_ver, 0, strpos($ext_ver, ":"));
 
                                                // Load SQLs from file
-                                               $SQLs = EXTENSION_UPDATE("ext-".$ext_name.".php", $ext_name, $ext_ver, true);
+                                               $SQLs = EXTENSION_UPDATE($ext_name, $ext_ver, true);
 
                                                // Add notes to text
                                                $text .= $NOTES;
@@ -226,7 +206,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                        } // END - if
                                } else {
                                        // Run SQL commands in dry mode but only return the notes
-                                       $SQLs = EXTENSION_UPDATE("ext-".$ext_name.".php", $ext_name, $ext_ver, true);
+                                       $SQLs = EXTENSION_UPDATE($ext_name, $ext_ver, true);
                                        $text .= $NOTES;
                                }
 
@@ -264,7 +244,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
 
                                                // Close task but not already closes or deleted or update tasks
                                                if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) {
-                                                       ADMIN_SOLVE_TASK($tid);
+                                                       RUN_FILTER('solve_task', $tid);
                                                } // END - if
                                        }
                                        break;
@@ -276,7 +256,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                        // Close task
                                        if (($status != "CLOSED") && ($status != "DELETED")) {
                                                // Solve the task
-                                               ADMIN_SOLVE_TASK($tid);
+                                               RUN_FILTER('solve_task', $tid);
                                        } // END - if
                                        break;
 
index ef2989fa916ef3a064fdd85ff1574a4cb2086439..1e7943f7429995b10b35f9d3fcd5451f0ddef9b2 100644 (file)
@@ -48,7 +48,7 @@ if ((!empty($_POST['uid'])) && (!empty($_POST['id'])))
         array(bigintval($_POST['uid'])), __FILE__, __LINE__);
 
        // Next the task system...
-       ADMIN_SOLVE_TASK($_POST['id']);
+       RUN_FILTER('solve_task', bigintval($_POST['id']));
 
        // Send mail to user
        $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_done", true, bigintval($_POST['uid']));
index de61dd27e92ddbc904936e9ef5b6f30a0aaaeed4..0c11dd2e44b5e03ce366a7de29692c0790e1d688 100644 (file)
@@ -122,7 +122,7 @@ if (!empty($_GET['pid'])) {
                                        if ($ret[0] == $eok) {
                                                // Clear task
                                                if ($task > 0) {
-                                                       ADMIN_SOLVE_TASK($task);
+                                                       RUN_FILTER('solve_task', $task);
                                                }
 
                                                // Clear payout request
@@ -161,7 +161,7 @@ if (!empty($_GET['pid'])) {
                        if (isset($_POST['ok'])) {
                                if ($task > 0) {
                                        // Clear task
-                                       ADMIN_SOLVE_TASK($task);
+                                       RUN_FILTER('solve_task', $task);
                                }
 
                                // Clear payout request
index d8de0073a218d89792dbd69134db25bb6f1cc7e8..fc86b7eb4ab39bdc5602d53be77962b0508f9596 100644 (file)
@@ -83,14 +83,24 @@ 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-back function for running shutdown functions and close database connection
+function __SHUTDOWN_HOOK () {
+       global $link;
+
        // Call the filter chain 'shutdown'
        RUN_FILTER('shutdown', null, false);
+
+       if (is_resource($link)) {
+               // Close link
+               SQL_CLOSE($link, __FILE__, __LINE__);
+       } else {
+               // No database link
+               ADD_FATAL(NO_DB_LINK);
+       }
 }
 
 // Register shutdown hook
-register_shutdown_function('__RUN_SHUTDOWN_FILTER');
+register_shutdown_function('__SHUTDOWN_HOOK');
 
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
index 6abad5048fe15f1a1aa7984742be33837b174e95..ec8d7ce688784133eef930093d2069c7b3ff6714 100644 (file)
@@ -267,7 +267,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
 
        // Get the title from menu
        $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE %s='%s' ".$AND." LIMIT 1",
-        array($ACC_LVL, $type, $search), __FILE__, __LINE__);
+               array($ACC_LVL, $type, $search), __FILE__, __LINE__);
 
        // Menu found?
        if (SQL_NUMROWS($result) == 1) {
@@ -287,24 +287,13 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
                        //* DEBUG: */ die("<pre>".print_r($_CONFIG, true)."</pre>");
                        if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) {
                                //* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
-                               $OUT .= "</div>\n";
-
-                               // Extension removeip activated?
-                               if ((EXT_IS_ACTIVE("removeip")) && (getConfig('removeip_'.strtolower($ACC_LVL).'_show') == "Y")) {
-                                       // Add anoymity/privacy infos
-                                       $OUT .= REMOVEIP_ADD_INFOS();
-                               } // END - if
-
-                               // Add line-break tag
-                               $OUT .= "<br />\n";
+                               // Add closing div and br-tag
+                               $OUT .= "</div><br />\n";
                                $NAV_DEPTH = "0";
 
-                               // Handle failed logins here if not in guest
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$type},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$ACC_LVL}<br />\n";
-                               if ((($type == "what") || ($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == getConfig('index_home')))) && ($ACC_LVL != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
-                                       // Handle failture
-                                       $OUT .= HANDLE_LOGIN_FAILTURES($ACC_LVL);
-                               } // END - if
+                               // Run the filter chain
+                               $ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
+                               $OUT .= $ret['content'];
                        } // END - if
                }
        } // END - if
@@ -1427,7 +1416,7 @@ function SEND_ADMIN_EMAILS ($subj, $msg) {
 function GET_ADMIN_ID ($login) {
        global $cacheArray, $_CONFIG;
        $ret = "-1";
-       if (!empty($cacheArray['admins']['aid'][$login])) {
+       if (isset($cacheArray['admins']['aid'][$login])) {
                // Check cache
                $ret = $cacheArray['admins']['aid'][$login];
 
@@ -1464,7 +1453,7 @@ function GET_ADMIN_HASH ($aid)
 {
        global $cacheArray, $_CONFIG;
        $ret = "-1";
-       if (!empty($cacheArray['admins']['password'][$aid])) {
+       if (isset($cacheArray['admins']['password'][$aid])) {
                // Check cache
                $ret = $cacheArray['admins']['password'][$aid];
 
@@ -1491,7 +1480,7 @@ function GET_ADMIN_HASH ($aid)
 function GET_ADMIN_LOGIN ($aid) {
        global $cacheArray, $_CONFIG;
        $ret = "***";
-       if (!empty($cacheArray['admins']['login'][$aid])) {
+       if (isset($cacheArray['admins']['login'][$aid])) {
                // Get cache
                $ret = $cacheArray['admins']['login'][$aid];
 
@@ -1519,7 +1508,7 @@ function GET_ADMIN_EMAIL ($aid) {
        global $cacheArray, $_CONFIG;
 
        $ret = "***";
-       if (!empty($cacheArray['admins']['email'][$aid])) {
+       if (isset($cacheArray['admins']['email'][$aid])) {
                // Get cache
                $ret = $cacheArray['admins']['email'][$aid];
 
@@ -1549,7 +1538,7 @@ function GET_ADMIN_DEFAULT_ACL ($aid) {
        global $cacheArray, $_CONFIG;
 
        $ret = "***";
-       if (!empty($cacheArray['admins']['def_acl'][$aid])) {
+       if (isset($cacheArray['admins']['def_acl'][$aid])) {
                // Use cache
                $ret = $cacheArray['admins']['def_acl'][$aid];
 
@@ -1805,56 +1794,6 @@ function GET_WHAT($modCheck) {
        return $wht;
 }
 
-// Checks if the module has a menu
-function MODULE_HAS_MENU ($mod, $forceDb = false) {
-       global $cacheArray, $_CONFIG;
-
-       // All is false by default
-       $ret = false;
-       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
-       if (GET_EXT_VERSION("cache") >= "0.1.2") {
-               // Cache version is okay, so let's check the cache!
-               if (isset($cacheArray['modules']['has_menu'][$mod])) {
-                       // Check module cache and count hit
-                       $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
-               } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
-                       // Check cache and count hit
-                       $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
-                       if (getConfig('cache_hits') > 0) { $_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__);
-
-               // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Load "has_menu" column
-                       list($has_menu) = SQL_FETCHROW($result);
-
-                       // Fake cache... ;-)
-                       $cacheArray['extensions']['ext_menu'][$mod] = $has_menu;
-
-                       // Does it have a menu?
-                       $ret = ($has_menu == "Y");
-               } // END  - if
-
-               // Free memory
-               SQL_FREERESULT($result);
-       } elseif (GET_EXT_VERSION("sql_patches") == "") {
-               // No sql_patches installed, so maybe in admin area?
-               $ret = ((IS_ADMIN()) && ($mod == "admin")); // Then there is a menu!
-       }
-
-       // Return status
-       //* DEBUG: */ var_dump($ret);
-       return $ret;
-}
-
 // Subtract points from database and mediadata cache
 function SUB_POINTS ($subject, $uid, $points) {
        // Add points to used points
index 628b18a310a0e99005e08ef57234f39b004f424d..f54f84bf4d95053040c7be1e4920084ac6548d2d 100644 (file)
@@ -52,14 +52,8 @@ $cnt = 0; $msg = "";
 // Load more cache includes
 $INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/pool/", "pool-");
 
-// Include all
-foreach ($INC_POOL as $fqfn) {
-       // Include the file
-       require_once($fqfn);
-} // END - foreach
-
-// Remove array
-unset($INC_POOL);
+// Run the filter
+RUN_FILTER('load_includes');
 
 // Remove message (IMPORTANT!)
 unset($msg);
diff --git a/templates/de/html/ext/ext_network.tpl b/templates/de/html/ext/ext_network.tpl
new file mode 100644 (file)
index 0000000..57f4c59
--- /dev/null
@@ -0,0 +1,3 @@
+Diese Erweiterung bietet eine allgemeine Anbindungsm&ouml;glichkeit an diverese
+Sponsorennetzwerken an, um z.B. deren Mails zu versenden. Sp&auml;ter sollen
+noch weitere Dinge, wie Textlinks oder Popups folgen.