Ticket #12735: 12736&12735.patch
File 12736&12735.patch, 8.7 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/ms.php
713 713 <?php foreach( (array) $all_blogs as $blog ) { 714 714 if ( $primary_blog == $blog->userblog_id ) 715 715 $found = true; 716 ?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>> http://<?php echo $blog->domain.$blog->path?></option><?php716 ?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>><?php echo $blog->homeurl?></option><?php 717 717 } ?> 718 718 </select> 719 719 <?php -
wp-admin/my-sites.php
68 68 $t = $t == 'border-right: 1px solid #ccc;' ? '' : 'border-right: 1px solid #ccc;'; 69 69 echo "<td valign='top' style='$t; width:50%'>"; 70 70 echo "<h3>{$user_blog->blogname}</h3>"; 71 echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='{$user_blog-> siteurl}'>" . __( 'Visit' ) . "</a> | <a href='{$user_blog->siteurl}/wp-admin/'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";71 echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='{$user_blog->homeurl}'>" . __( 'Visit' ) . "</a> | <a href='{$user_blog->siteurl}/wp-admin/'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>"; 72 72 echo apply_filters( 'myblogs_options', '', $user_blog ); 73 73 echo "</td>"; 74 74 } -
wp-includes/link-template.php
1836 1836 if ( empty($blog_id) || !is_multisite() ) 1837 1837 $home = get_option('home'); 1838 1838 else 1839 $home = untrailingslashit(get_blogaddress_by_id($blog_id));1839 $home = get_blog_option($blog_id,'home'); 1840 1840 1841 1841 $url = str_replace( 'http://', "$scheme://", $home ); 1842 1842 … … 1898 1898 if ( empty($blog_id) || !is_multisite() ) 1899 1899 $url = get_option('siteurl'); 1900 1900 else 1901 $url = untrailingslashit(get_blogaddress_by_id($blog_id)); 1902 1901 $url = get_blog_option($blog_id,'siteurl'); 1903 1902 $url = str_replace( 'http://', "{$scheme}://", $url ); 1904 1903 1905 1904 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 1906 1905 $url .= '/' . ltrim($path, '/'); 1907 1908 1906 return apply_filters('site_url', $url, $path, $orig_scheme, $blog_id); 1909 1907 } 1910 1908 -
wp-includes/ms-blogs.php
19 19 } 20 20 21 21 function get_blogaddress_by_id( $blog_id ) { 22 $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! 23 return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ); 22 return get_blog_option($blog_id,'home'); 24 23 } 25 24 26 25 function get_blogaddress_by_name( $blogname ) { … … 29 28 if ( is_subdomain_install() ) { 30 29 if ( $blogname == 'main' ) 31 30 $blogname = 'www'; 32 return esc_url( 'http://' . $blogname . '.' . $current_site->domain . $current_site->path);31 return esc_url( 'http://' . $blogname . '.' . trailingslashit($current_site->homeurl) ); 33 32 } else { 34 return esc_url( 'http://' . $current_site->domain . $current_site->path. $blogname . '/' );33 return esc_url( 'http://' . trailingslashit($current_site->homeurl) . $blogname . '/' ); 35 34 } 36 35 } 37 36 38 37 function get_blogaddress_by_domain( $domain, $path ){ 39 38 if ( is_subdomain_install() ) { 40 $url = "http://".$domain .$path;39 $url = "http://".$domain; 41 40 } else { 42 41 if ( $domain != $_SERVER['HTTP_HOST'] ) { 43 42 $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); … … 165 164 wp_cache_set( $blog_id . $all, $details, 'blog-details' ); 166 165 return $details; 167 166 } 168 167 $details->homeurl = get_blog_option( $blog_id, 'home'); 169 168 $details->blogname = get_blog_option( $blog_id, 'blogname' ); 170 169 $details->siteurl = get_blog_option( $blog_id, 'siteurl' ); 171 170 $details->post_count = get_blog_option( $blog_id, 'post_count' ); -
wp-includes/ms-functions.php
68 68 $blogs[ $blog_id ]->path = $blog->path; 69 69 $blogs[ $blog_id ]->site_id = $blog->site_id; 70 70 $blogs[ $blog_id ]->siteurl = $blog->siteurl; 71 $blogs[ $blog_id ]->homeurl = $blog->homeurl; 71 72 } 72 73 } 73 74 } -
wp-includes/ms-load.php
96 96 * @return object $current_site object 97 97 */ 98 98 function wpmu_current_site() { 99 global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain; 99 global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain,$sitepath; 100 $sitepath = defined('PATH_WP_INSTALL') ? PATH_WP_INSTALL:''; 100 101 if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { 101 102 $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; 102 103 $current_site->domain = DOMAIN_CURRENT_SITE; 103 104 $current_site->path = $path = PATH_CURRENT_SITE; 105 $current_site->sitepath = $sitepath; 104 106 if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) 105 107 $current_site->blog_id = BLOG_ID_CURRENT_SITE; 106 108 elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated. … … 111 113 $current_site->cookie_domain = substr( $current_site->domain, 4 ); 112 114 else 113 115 $current_site->cookie_domain = $current_site->domain; 114 116 if(is_subdomain_install()){ 117 $current_site->homeurl=$current_site->domain; 118 $current_site->siteurl=$current_site->domain.$current_site->sitepath; 119 }else{ 120 $current_site->homeurl=$current_site->domain.$current_site->path; 121 $current_site->siteurl=$current_site->domain.$current_site->path.$current_site->sitepath; 122 } 115 123 wp_load_core_site_options( $current_site->id ); 116 124 117 125 return $current_site; … … 120 128 $current_site = wp_cache_get( 'current_site', 'site-options' ); 121 129 if ( $current_site ) 122 130 return $current_site; 123 131 124 132 $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site 125 133 if ( 1 == count( $sites ) ) { 126 134 $current_site = $sites[0]; … … 130 138 $current_site = get_current_site_name( $current_site ); 131 139 if ( substr( $current_site->domain, 0, 4 ) == 'www.' ) 132 140 $current_site->cookie_domain = substr( $current_site->domain, 4 ); 141 $current_site->sitepath = $sitepath; 142 if(is_subdomain_install()){ 143 $current_site->homeurl=$current_site->domain; 144 $current_site->siteurl=$current_site->domain.$current_site->sitepath; 145 }else{ 146 $current_site->homeurl=$current_site->domain.$current_site->path; 147 $current_site->siteurl=$current_site->domain.$current_site->path.$current_site->sitepath; 148 } 133 149 wp_cache_set( 'current_site', $current_site, 'site-options' ); 134 150 return $current_site; 135 151 } … … 150 166 if ( $current_site ) { 151 167 $path = $current_site->path; 152 168 $current_site->cookie_domain = $cookie_domain; 169 $current_site->sitepath = $sitepath; 170 if(is_subdomain_install()){ 171 $current_site->homeurl=$current_site->domain; 172 $current_site->siteurl=$current_site->domain.$current_site->sitepath; 173 }else{ 174 $current_site->homeurl=$current_site->domain.$current_site->path; 175 $current_site->siteurl=$current_site->domain.$current_site->path.$current_site->sitepath; 176 } 153 177 return $current_site; 154 178 } 155 179 … … 157 181 $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); 158 182 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) ); 159 183 if ( $current_site ) { 184 $current_site->sitepath = $sitepath; 160 185 $current_site->cookie_domain = $current_site->domain; 186 $current_site->homeurl=$current_site->domain; 187 $current_site->siteurl=$current_site->domain.$current_site->sitepath; 161 188 return $current_site; 162 189 } 163 164 190 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) ); 165 191 } 166 192 167 193 if ( $current_site || defined( 'WP_INSTALLING' ) ) { 168 $path = '/'; 194 $path = '/'; 195 $current_site->sitepath = $sitepath; 196 if(is_subdomain_install()){ 197 $current_site->homeurl=$current_site->domain; 198 $current_site->siteurl=$current_site->domain.$current_site->sitepath; 199 }else{ 200 $current_site->homeurl=$current_site->domain.$current_site->path; 201 $current_site->siteurl=$current_site->domain.$current_site->path.$current_site->sitepath; 202 } 169 203 return $current_site; 170 204 } 171 205