Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeanMarkTaylor/5341540 to your computer and use it in GitHub Desktop.
Save DeanMarkTaylor/5341540 to your computer and use it in GitHub Desktop.
WordPress MU Domain Mapping - 0.5.4.3 - Patch - Fix PHP notices and warnings
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 694026)
+++ domain_mapping.php (working copy)
@@ -370,7 +370,7 @@
exit;
break;
}
- } elseif( $_GET[ 'action' ] == 'delete' ) {
+ } elseif ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' ) {
$domain = $wpdb->escape( $_GET[ 'domain' ] );
if ( $domain == '' ) {
wp_die( __( "You must enter a domain", 'wordpress-mu-domain-mapping' ) );
@@ -444,7 +444,11 @@
$domains = $wpdb->get_results( "SELECT * FROM {$wpdb->dmtable} WHERE blog_id = '{$wpdb->blogid}'", ARRAY_A );
if ( is_array( $domains ) && !empty( $domains ) ) {
$orig_url = parse_url( get_original_url( 'siteurl' ) );
- $domains[] = array( 'domain' => $orig_url[ 'host' ], 'path' => $orig_url[ 'path' ], 'active' => 0 );
+ $domains[] = array(
+ 'domain' => $orig_url['host'],
+ 'path' => ( empty( $orig_url['path'] ) ? '' : $orig_url['path'] ),
+ 'active' => 0
+ );
echo "<h3>" . __( 'Active domains on this blog', 'wordpress-mu-domain-mapping' ) . "</h3>";
echo '<form method="POST">';
echo "<table><tr><th>" . __( 'Primary', 'wordpress-mu-domain-mapping' ) . "</th><th>" . __( 'Domain', 'wordpress-mu-domain-mapping' ) . "</th><th>" . __( 'Delete', 'wordpress-mu-domain-mapping' ) . "</th></tr>\n";
@@ -459,7 +463,10 @@
if ( $details[ 'active' ] == 1 )
echo "checked='1' ";
echo "/>";
- $url = "{$protocol}{$details[ 'domain' ]}{$details[ 'path' ]}";
+ $url = "{$protocol}{$details[ 'domain' ]}";
+ if ( !empty( $details['path'] ) ) {
+ $url .= $details['path'];
+ }
echo "</td><td><a href='$url'>$url</a></td><td style='text-align: center'>";
if ( $details[ 'domain' ] != $orig_url[ 'host' ] && $details[ 'active' ] != 1 ) {
echo "<a href='" . wp_nonce_url( add_query_arg( array( 'domain' => $details[ 'domain' ] ), $del_url ), "delete" . $details[ 'domain' ] ) . "'>Del</a>";
@@ -629,7 +636,10 @@
}
function redirect_login_to_orig() {
- if ( !get_site_option( 'dm_remote_login' ) || $_GET[ 'action' ] == 'logout' || isset( $_GET[ 'loggedout' ] ) ) {
+ if ( !get_site_option( 'dm_remote_login' ) ||
+ ( isset( $_GET['action'] ) && $_GET['action'] == 'logout' ) ||
+ isset( $_GET['loggedout'] )
+ ) {
return false;
}
$url = get_original_url( 'siteurl' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment