diff --git a/admin.php b/admin.php index 31b3f26..5ee4d8a 100644 --- a/admin.php +++ b/admin.php @@ -88,11 +88,12 @@ function maybe_output_site_tab() { * @param array $messages Messages to display */ function output_page_header( $id, $messages = array() ) { + global $title, $parent_file, $submenu_file, $pagenow; + $site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); $title_site_url_linked = sprintf( __('Aliases: %2$s'), get_blogaddress_by_id( $id ), $site_url_no_http ); // Load the page header - global $title, $parent_file, $submenu_file; $title = sprintf( __( 'Aliases: %s', 'mercator' ), $site_url_no_http ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; @@ -154,6 +155,8 @@ function output_page_footer() { * @param string $action Action to perform */ function handle_list_page_submit( $id, $action ) { + global $parent_file; + check_admin_referer( 'mercator-aliases-bulk-' . $id ); $sendback = remove_query_arg( array( 'did_action', 'mappings', '_wpnonce' ), wp_get_referer() ); diff --git a/class-mapping.php b/class-mapping.php index 65120ee..230697a 100644 --- a/class-mapping.php +++ b/class-mapping.php @@ -367,7 +367,7 @@ public static function create( $site, $domain, $active = false ) { } if ( ! empty( $existing ) ) { // Domain exists already... - if ( $site !== $mapping->get_site_id() ) { + if ( $site !== $existing->get_site_id() ) { // ...and points to another site return new \WP_Error( 'mercator.mapping.domain_exists' ); } @@ -390,7 +390,7 @@ public static function create( $site, $domain, $active = false ) { // Check that the table exists... if ( check_table() === 'created' ) { // Table created, try again - return static::create( $site, $domain ); + return static::create( $site, $domain, $active ); } // Other error. We suppressed errors before, so we need to make sure