Index: wp-admin/includes/plugin.php
===================================================================
--- wp-admin/includes/plugin.php	(revision 18305)
+++ wp-admin/includes/plugin.php	(working copy)
@@ -255,6 +255,11 @@
 
 	if ( empty($plugin_files) )
 		return $wp_plugins;
+		
+	/**
+	 * @author 5ubliminal
+	 */
+	$plugin_files = apply_filters('get_plugins_files', $plugin_files); // [HACK]
 
 	foreach ( $plugin_files as $plugin_file ) {
 		if ( !is_readable( "$plugin_root/$plugin_file" ) )
@@ -273,7 +278,10 @@
 	$cache_plugins[ $plugin_folder ] = $wp_plugins;
 	wp_cache_set('plugins', $cache_plugins, 'plugins');
 
-	return $wp_plugins;
+	/**
+	 * @author 5ubliminal
+	 */
+	return apply_filters('get_plugins', $wp_plugins);
 }
 
 /**
Index: wp-includes/load.php
===================================================================
--- wp-includes/load.php	(revision 18305)
+++ wp-includes/load.php	(working copy)
@@ -455,7 +455,10 @@
 	closedir( $dh );
 	sort( $mu_plugins );
 
-	return $mu_plugins;
+	/**
+	 * @author 5ubliminal
+	 */
+	return apply_filters('get_mu_plugins', $mu_plugins);
 }
 
 /**
@@ -484,6 +487,11 @@
 
 	$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
 
+	/**
+	 * @author 5ubliminal
+	 */
+	$active_plugins = apply_filters('active_and_valid_plugins', $plugins);
+	
 	foreach ( $active_plugins as $plugin ) {
 		if ( ! validate_file( $plugin ) // $plugin must validate as file
 			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
@@ -493,7 +501,10 @@
 			)
 		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
 	}
-	return $plugins;
+	/**
+	 * @author 5ubliminal
+	 */
+	return apply_filters('get_active_and_valid_plugins', $plugins);
 }
 
 /**
Index: wp-includes/ms-load.php
===================================================================
--- wp-includes/ms-load.php	(revision 18305)
+++ wp-includes/ms-load.php	(working copy)
@@ -45,6 +45,11 @@
 	$active_plugins = array_keys( $active_plugins );
 	sort( $active_plugins );
 
+	/**
+	 * @author 5ubliminal
+	 */
+	$active_plugins = apply_filters('active_network_plugins', $active_plugins);
+	
 	foreach ( $active_plugins as $plugin ) {
 		if ( ! validate_file( $plugin ) // $plugin must validate as file
 			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
@@ -52,7 +57,11 @@
 			)
 		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
 	}
-	return $plugins;
+
+	/**
+	 * @author 5ubliminal
+	 */
+	return apply_filters('get_active_network_plugins', $plugins);
 }
 
 /**
Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php	(revision 18305)
+++ wp-includes/plugin.php	(working copy)
@@ -65,6 +65,17 @@
 function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
 	global $wp_filter, $merged_filters;
 
+	/**
+	 * No longer violently unset($wp_filter); in wp-settings.php line #38-some.
+	 * We empty this on first call or if we find it's not an array().
+	 * This function is the only one that should add data to it so it has every right to reset it on first run.
+	 * 
+	 * And we count calls by using a static variable.
+	 */
+	static $hits = 0;
+	if(!$hits or !is_array($wp_filter)) $wp_filter = array(); // Reset filters on first run or on type mismatch
+	$hits++; // Increment hit count
+	
 	$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
 	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
 	unset( $merged_filters[ $tag ] );
Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 18305)
+++ wp-includes/theme.php	(working copy)
@@ -745,6 +745,15 @@
 	if ( empty( $templates ) )
 		$templates = array("{$type}.php");
 
+	/**
+	 * Allow the use of one major filter named 'query_template'.
+	 * Only if the returned value is an array() will it be used to replace previous array().
+	 * This is to prevent accidental returns of NULLs or such.
+	 * @author 5ubliminal
+	 */
+	is_array( $new_templates = apply_filters( "query_template", $templates, $type ) ) and
+		!empty( $new_templates ) and ( $templates = $new_templates );
+	
 	return apply_filters( "{$type}_template", locate_template( $templates ) );
 }
 
Index: wp-login.php
===================================================================
--- wp-login.php	(revision 18305)
+++ wp-login.php	(working copy)
@@ -367,7 +367,11 @@
 	setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
 
 // allow plugins to override the default actions, and to add extra actions if they want
-do_action( 'login_init' );
+/**
+ * We should also get the action name here.
+ * @author 5ubliminal
+ */
+do_action( 'login_init', $action );
 do_action( 'login_form_' . $action );
 
 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 18305)
+++ wp-settings.php	(working copy)
@@ -35,7 +35,12 @@
 wp_unregister_GLOBALS();
 
 // Ensure these global variables do not exist so they do not interfere with WordPress.
-unset( $wp_filter, $cache_lastcommentmodified );
+/**
+ * We now reset $wp_filter directly in the add_filter() function,
+ * the only function that should legally alter it.
+ * @author 5ubliminal
+ */
+unset($cache_lastcommentmodified); // unset( $wp_filter, $cache_lastcommentmodified );
 
 // Standardize $_SERVER variables across setups.
 wp_fix_server_vars();
