WordPress MU Domain Mapping - 0.5.4.3 - Patch - Fix PHP notices and warnings

  • Download Gist
domain_mapping.php - fix-php-notices-warnings.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
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' );

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.