diff -Naur wordpress/wp-admin/admin-functions.php wordpress.multisite/wp-admin/admin-functions.php
--- wordpress/wp-admin/admin-functions.php 2007-01-17 19:32:54.000000000 -0800
+++ wordpress.multisite/wp-admin/admin-functions.php 2007-02-20 16:06:39.000000000 -0800
@@ -1654,6 +1654,21 @@
return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1] );
}
+function get_plugin_path( $plugin = NULL ) {
+ $plugin_root = ABSPATH . PLUGINDIR;
+ $plugin_site_root = ABSPATH . 'wp-sites/' . WPSITE . '/plugins';
+
+ if ($plugin == NULL) {
+ return ABSPATH . PLUGINDIR;
+ }
+
+ if ( file_exists($plugin_site_root . "/$plugin") ) {
+ return $plugin_site_root . "/$plugin";
+ } else {
+ return $plugin_root . "/$plugin";
+ }
+}
+
function get_plugins() {
global $wp_plugins;
@@ -1661,8 +1676,16 @@
return $wp_plugins;
}
- $wp_plugins = array ();
$plugin_root = ABSPATH . PLUGINDIR;
+ $plugin_site_root = ABSPATH . 'wp-sites/' . WPSITE . '/plugins';
+ $wp_plugins = _get_plugins($plugin_root);
+ $wp_plugins = array_merge($wp_plugins, _get_plugins($plugin_site_root));
+
+ return $wp_plugins;
+}
+
+function _get_plugins( $plugin_root ) {
+ $wp_plugins = array ();
// Files in wp-content/plugins directory
$plugins_dir = @ dir( $plugin_root);
diff -Naur wordpress/wp-admin/admin.php wordpress.multisite/wp-admin/admin.php
--- wordpress/wp-admin/admin.php 2006-12-13 11:21:09.000000000 -0800
+++ wordpress.multisite/wp-admin/admin.php 2007-02-20 16:01:45.000000000 -0800
@@ -52,7 +52,7 @@
wp_die(__('Invalid plugin page'));
}
- if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page"))
+ if (! file_exists(get_plugin_path("$plugin_page")))
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
do_action('load-' . $plugin_page);
@@ -60,7 +60,7 @@
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
- include(ABSPATH . PLUGINDIR . "/$plugin_page");
+ include(get_plugin_path("$plugin_page"));
}
include(ABSPATH . 'wp-admin/admin-footer.php');
diff -Naur wordpress/wp-admin/menu-header.php wordpress.multisite/wp-admin/menu-header.php
--- wordpress/wp-admin/menu-header.php 2006-11-18 23:56:05.000000000 -0800
+++ wordpress.multisite/wp-admin/menu-header.php 2007-02-20 16:02:10.000000000 -0800
@@ -14,12 +14,12 @@
if ( !empty($submenu[$item[2]]) ) {
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
- if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+ if ( file_exists(get_plugin_path("{$submenu[$item[2]][0][2]}")) || !empty($menu_hook))
echo "\n\t
{$item[0]}";
else
echo "\n\t{$item[0]}";
} else if ( current_user_can($item[1]) ) {
- if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
+ if ( file_exists(get_plugin_path("{$item[2]}")) )
echo "\n\t{$item[0]}";
else
echo "\n\t{$item[0]}";
@@ -47,7 +47,7 @@
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
-if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
+if (file_exists(get_plugin_path("{$item[2]}")) || ! empty($menu_hook)) {
if ( 'admin.php' == $pagenow )
echo "\n\t{$item[0]}";
else
diff -Naur wordpress/wp-admin/plugins.php wordpress.multisite/wp-admin/plugins.php
--- wordpress/wp-admin/plugins.php 2006-12-26 16:51:00.000000000 -0800
+++ wordpress.multisite/wp-admin/plugins.php 2007-02-20 16:02:35.000000000 -0800
@@ -8,13 +8,13 @@
$plugin = trim($_GET['plugin']);
if ( validate_file($plugin) )
wp_die(__('Invalid plugin.'));
- if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
+ if ( ! file_exists(get_plugin_path($plugin)) )
wp_die(__('Plugin file does not exist.'));
if (!in_array($plugin, $current)) {
$current[] = $plugin;
sort($current);
update_option('active_plugins', $current);
- include(ABSPATH . PLUGINDIR . '/' . $plugin);
+ include(get_plugin_path($plugin));
do_action('activate_' . $plugin);
}
wp_redirect('plugins.php?activate=true');
@@ -47,7 +47,7 @@
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ($check_plugins as $check_plugin) {
- if (!file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin)) {
+ if (!file_exists(get_plugin_path($check_plugin))) {
$current = get_option('active_plugins');
$key = array_search($check_plugin, $current);
if ( false !== $key && NULL !== $key ) {
diff -Naur wordpress/wp-config.php wordpress.multisite/wp-config.php
--- wordpress/wp-config.php 1969-12-31 16:00:00.000000000 -0800
+++ wordpress.multisite/wp-config.php 2007-02-20 16:18:51.000000000 -0800
@@ -0,0 +1,9 @@
+
diff -Naur wordpress/wp-includes/theme.php wordpress.multisite/wp-includes/theme.php
--- wordpress/wp-includes/theme.php 2007-01-21 12:03:02.000000000 -0800
+++ wordpress.multisite/wp-includes/theme.php 2007-02-20 16:14:30.000000000 -0800
@@ -89,14 +89,25 @@
}
function get_themes() {
- global $wp_themes, $wp_broken_themes;
-
+ global $wp_themes;
+
if ( isset($wp_themes) )
return $wp_themes;
+
+ $theme_root = get_theme_root(TRUE);
+ $theme_site_root = get_theme_site_root();
+ $themes = _get_themes($theme_root);
+ $themes = array_merge($themes, _get_themes($theme_site_root));
+
+ $wp_themes = $themes;
+ return $themes;
+}
+
+function _get_themes($theme_root) {
+ global $wp_broken_themes;
$themes = array();
$wp_broken_themes = array();
- $theme_root = get_theme_root();
$theme_loc = str_replace(ABSPATH, '', $theme_root);
// Files in wp-content/themes directory and one subdir down
@@ -255,8 +266,6 @@
}
}
- $wp_themes = $themes;
-
return $themes;
}
@@ -289,12 +298,32 @@
return $current_theme;
}
-function get_theme_root() {
- return apply_filters('theme_root', ABSPATH . "wp-content/themes");
+function get_theme_root($master = FALSE) {
+ $template = get_template();
+ $template_dir = get_theme_site_root() . "/$template";
+ if ( !$master && file_exists($template_dir . '/index.php') ) {
+ return get_theme_site_root();
+ } else {
+ return apply_filters('theme_root', ABSPATH . "wp-content/themes");
+ }
+}
+
+function get_theme_site_root() {
+ return apply_filters('theme_root', ABSPATH . "wp-sites/" . WPSITE . "/themes");
}
-function get_theme_root_uri() {
- return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
+function get_theme_root_uri($master = FALSE) {
+ $template = get_template();
+ $template_dir = get_theme_site_root() . "/$template";
+ if ( ! $master && file_exists($template_dir . '/index.php') ) {
+ return get_theme_site_root_uri();
+ } else {
+ return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
+ }
+}
+
+function get_theme_site_root_uri() {
+ return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-sites/" . WPSITE . "/themes", get_option('siteurl'));
}
function get_query_template($type) {
@@ -416,7 +445,6 @@
// Don't validate during an install/upgrade.
if ( defined('WP_INSTALLING') )
return true;
-
if ( get_template() != 'default' && !file_exists(get_template_directory() . '/index.php') ) {
update_option('template', 'default');
update_option('stylesheet', 'default');