[no-wp] r238 committed - tagged wordpress-mu-domain-mapping 0.5.3

4 views
Skip to first unread message

no...@googlecode.com

unread,
Jan 17, 2011, 4:41:13 AM1/17/11
to no...@googlegroups.com
Revision: 238
Author: peter.holme
Date: Mon Jan 17 01:40:46 2011
Log: tagged wordpress-mu-domain-mapping 0.5.3
http://code.google.com/p/no-wp/source/detail?r=238

Added:
/plugins/wordpress-mu-domain-mapping/tags/0.5.3
Deleted:
/plugins/wordpress-mu-domain-mapping/tags/0.5.3/domain_mapping.php
/plugins/wordpress-mu-domain-mapping/tags/0.5.3/les_meg.txt
/plugins/wordpress-mu-domain-mapping/trunk/domain_mapping.php
/plugins/wordpress-mu-domain-mapping/trunk/les_meg.txt
Modified:

/plugins/wordpress-mu-domain-mapping/tags/0.5.3/languages/wordpress-mu-domain-mapping-nb_NO.mo

/plugins/wordpress-mu-domain-mapping/tags/0.5.3/languages/wordpress-mu-domain-mapping-nb_NO.po

/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.mo

/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.po

=======================================
--- /plugins/wordpress-mu-domain-mapping/trunk/domain_mapping.php Thu Jul
1 10:27:27 2010
+++ /dev/null
@@ -1,740 +0,0 @@
-<?php
-/*
-Plugin Name: WordPress MU Domain Mapping
-Plugin URI: http://ocaoimh.ie/wordpress-mu-domain-mapping/
-Description: Map any blog on a WordPress website to another domain.
-Version: 0.5.2
-Author: Donncha O Caoimh
-Author URI: http://ocaoimh.ie/
-*/
-/* Copyright Donncha O Caoimh (http://ocaoimh.ie/)
- With contributions by Ron Rennick(http://wpmututorials.com/), Greg
Sidberry and others.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
-*/
-
-function dm_text_domain() {
- load_plugin_textdomain( 'wordpress-mu-domain-mapping', basename( dirname(
__FILE__ ) ) . 'languages', 'wordpress-mu-domain-mapping/languages' );
-}
-add_action( 'init', 'dm_text_domain' );
-
-function domain_mapping_warning() {
- echo "<div id='domain-mapping-warning' class='updated
fade'><p><strong>".__( 'Domain Mapping
Disabled.', 'wordpress-mu-domain-mapping' )."</strong> ".sprintf(__('You
must <a href="%1$s">create a network</a> for it to
work.', 'wordpress-mu-domain-mapping'
), "http://codex.wordpress.org/Create_A_Network")."</p></div>";
-}
-
-function dm_add_pages() {
- global $current_site, $wpdb, $wp_db_version;
-
- if ( !isset( $current_site ) && $wp_db_version >= 15260 ) { // WP 3.0
network hasn't been configured
- add_action('admin_notices', 'domain_mapping_warning');
- return false;
- }
- if ( $current_site->path != "/" ) {
- wp_die( __( "The domain mapping plugin only works if the site is
installed in /. This is a limitation of how virtual servers work and is
very difficult to work around.", 'wordpress-mu-domain-mapping' ) );
- }
-
- maybe_create_db();
-
- if ( get_site_option( 'dm_user_settings' ) && $current_site->blog_id !=
$wpdb->blogid && !dm_sunrise_warning( false ) ) {
- add_management_page(__( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), 'manage_options', 'domainmapping', 'dm_manage_page'
);
- }
- if( is_site_admin() ) {
- add_submenu_page('wpmu-admin.php', __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), 'manage_options', 'dm_admin_page', 'dm_admin_page');
- add_submenu_page('wpmu-admin.php',
__( 'Domains', 'wordpress-mu-domain-mapping'),
__( 'Domains', 'wordpress-mu-domain-mapping'), 'manage_options', 'dm_domains_admin', 'dm_domains_admin');
- }
-}
-add_action( 'admin_menu', 'dm_add_pages' );
-
-// Default Messages for the users Domain Mapping management page
-// This can now be replaced by using:
-// remove_action('dm_echo_updated_msg','dm_echo_default_updated_msg');
-// add_action('dm_echo_updated_msg','my_custom_updated_msg_function');
-function dm_echo_default_updated_msg() {
- switch( $_GET[ 'updated' ] ) {
- case "add":
- $msg = __( 'New domain added.', 'wordpress-mu-domain-mapping' );
- break;
- case "exists":
- $msg = __( 'New domain already exists.', 'wordpress-mu-domain-mapping'
);
- break;
- case "primary":
- $msg = __( 'New primary domain.', 'wordpress-mu-domain-mapping' );
- break;
- case "del":
- $msg = __( 'Domain deleted.', 'wordpress-mu-domain-mapping' );
- break;
- }
- echo "<div class='updated fade'><p>$msg</p></div>";
-}
-add_action('dm_echo_updated_msg','dm_echo_default_updated_msg');
-
-function maybe_create_db() {
- global $wpdb;
-
- get_dm_hash(); // initialise the remote login hash
-
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- if ( is_site_admin() ) {
- $created = 0;
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtable}'") !=
$wpdb->dmtable ) {
- $wpdb->query( "CREATE TABLE IF NOT EXISTS `{$wpdb->dmtable}` (
- `id` bigint(20) NOT NULL auto_increment,
- `blog_id` bigint(20) NOT NULL,
- `domain` varchar(255) NOT NULL,
- `active` tinyint(4) default '1',
- PRIMARY KEY (`id`),
- KEY `blog_id` (`blog_id`,`domain`,`active`)
- );" );
- $created = 1;
- }
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtablelogins}'") !=
$wpdb->dmtablelogins ) {
- $wpdb->query( "CREATE TABLE IF NOT EXISTS `{$wpdb->dmtablelogins}` (
- `id` varchar(32) NOT NULL,
- `user_id` bigint(20) NOT NULL,
- `blog_id` bigint(20) NOT NULL,
- `t` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`)
- );" );
- $created = 1;
- }
- if ( $created ) {
- ?> <div id="message" class="updated fade"><p><strong><?php _e( 'Domain
mapping database table created.', 'wordpress-mu-domain-mapping'
) ?></strong></p></div> <?php
- }
- }
-
-}
-
-function dm_domains_admin() {
- global $wpdb, $current_site;
- if ( false == is_site_admin() ) { // paranoid? moi?
- return false;
- }
-
- dm_sunrise_warning();
-
- if ( $current_site->path != "/" ) {
- wp_die( sprintf( __( "<strong>Warning!</strong> This plugin will only
work if WordPress is installed in the root directory of your webserver. It
is currently installed in &#8217;%s&#8217;.", "wordpress-mu-domain-mapping"
), $current_site->path ) );
- }
-
- switch( $_POST[ 'action' ] ) {
- default:
- }
- echo '<h2>' . __( 'Domain Mapping:
Domains', 'wordpress-mu-domain-mapping' ) . '</h2>';
- if ( !empty( $_POST[ 'action' ] ) ) {
- check_admin_referer( 'domain_mapping' );
- switch( $_POST[ 'action' ] ) {
- case "edit":
- $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->dmtable}
WHERE domain = %s", $_POST[ 'domain' ] ) );
- if ( $row ) {
- dm_edit_domain( $row );
- } else {
- echo "<h3>" . __( 'Domain not found', 'wordpress-mu-domain-mapping'
) . "</h3>";
- }
- break;
- case "save":
- if ( $_POST[ 'blog_id' ] != 0 AND
- $_POST[ 'blog_id' ] != 1 AND
- null == $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM
{$wpdb->dmtable} WHERE blog_id != %d AND domain = %s", $_POST[ 'blog_id' ],
$_POST[ 'domain' ] ) )
- ) {
- if ( $_POST[ 'orig_domain' ] == '' ) {
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} (
`blog_id`, `domain`, `active` ) VALUES ( %d, %s, %d )", $_POST[ 'blog_id'
], $_POST[ 'domain' ], $_POST[ 'active' ] ) );
- echo "<p><strong>" . __( 'Domain Add', 'wordpress-mu-domain-mapping'
) . "</strong></p>";
- } else {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET blog_id
= %d, domain = %s, active = %d WHERE domain = %s", $_POST[ 'blog_id' ],
$_POST[ 'domain' ], $_POST[ 'active' ], $_POST[ 'orig_domain' ] ) );
- echo "<p><strong>" . __( 'Domain
Updated', 'wordpress-mu-domain-mapping' ) . "</strong></p>";
- }
- }
- break;
- case "del":
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtable} WHERE
domain = %s", $_POST[ 'domain' ] ) );
- echo "<p><strong>" . __( 'Domain
Deleted', 'wordpress-mu-domain-mapping' ) . "</strong></p>";
- break;
- case "search":
- $rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtable} WHERE domain LIKE %s", $_POST[ 'domain' ] ) );
- dm_domain_listing( $rows, sprintf( __( "Searching
for %s", 'wordpress-mu-domain-mapping' ), $_POST[ 'domain' ] ) );
- break;
- }
- if ( $_POST[ 'action' ] == 'update' ) {
- add_site_option( 'dm_ipaddress', $_POST[ 'ipaddress' ] );
- add_site_option( 'dm_cname', $_POST[ 'cname' ] );
- add_site_option( 'dm_301_redirect', intval(
$_POST[ 'permanent_redirect' ] ) );
- }
- }
-
- echo "<h3>" . __( 'Search Domains', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo '<form method="POST">';
- wp_nonce_field( 'domain_mapping' );
- echo '<input type="hidden" name="action" value="search" />';
- echo _e( "Domain:", 'wordpress-mu-domain-mapping' );
- echo " <input type='text' name='domain' value='' /><br />";
- echo "<input type='submit' value='" .
__( 'Search', 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
- dm_edit_domain();
- $rows = $wpdb->get_results( "SELECT * FROM {$wpdb->dmtable} ORDER BY id
DESC LIMIT 0,20" );
- dm_domain_listing( $rows );
-}
-
-function dm_edit_domain( $row = false ) {
- if ( is_object( $row ) ) {
- echo "<h3>" . __( 'Edit Domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- } else {
- echo "<h3>" . __( 'New Domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- $row->blog_id = '';
- $row->domain = '';
- $_POST[ 'domain' ] = '';
- $row->active = 1;
- }
-
- echo "<form method='POST'><input type='hidden' name='action' value='save'
/><input type='hidden' name='orig_domain' value='{$_POST[ 'domain' ]}' />";
- wp_nonce_field( 'domain_mapping' );
- echo "<table class='form-table'>\n";
- echo "<tr><th>" . __( 'Site ID', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='text' name='blog_id' value='{$row->blog_id}'
/></td></tr>\n";
- echo "<tr><th>" . __( 'Domain', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='text' name='domain' value='{$row->domain}'
/></td></tr>\n";
- echo "<tr><th>" . __( 'Primary', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='checkbox' name='active' value='1' ";
- echo $row->active == 1 ? 'checked=1 ' : ' ';
- echo "/></td></tr>\n";
- echo "</table>";
- echo "<input type='submit'
value='" .__( 'Save', 'wordpress-mu-domain-mapping' ). "' /></form><br
/><br />";
-}
-
-function dm_domain_listing( $rows, $heading = '' ) {
- if ( $rows ) {
- if ( $heading != '' )
- echo "<h3>$heading</h3>";
- echo '<table class="widefat" cellspacing="0"><thead><tr><th>'.__( 'Site
ID', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Domain', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Primary', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Edit', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Delete', 'wordpress-mu-domain-mapping'
).'</th></tr></thead><tbody>';
- foreach( $rows as $row ) {
- echo "<tr><td><a
href='wpmu-blogs.php?action=editblog&id={$row->blog_id}'>{$row->blog_id}</a></td><td><a
href='http://{$row->domain}/'>{$row->domain}</a></td><td>";
- echo $row->active == 1 ? __( 'Yes', 'wordpress-mu-domain-mapping' ) :
__( 'No', 'wordpress-mu-domain-mapping' );
- echo "</td><td><form method='POST'><input type='hidden' name='action'
value='edit' /><input type='hidden' name='domain' value='{$row->domain}'
/>";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit'
value='" .__( 'Edit', 'wordpress-mu-domain-mapping' ). "'
/></form></td><td><form method='POST'><input type='hidden' name='action'
value='del' /><input type='hidden' name='domain' value='{$row->domain}' />";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit'
value='" .__( 'Del', 'wordpress-mu-domain-mapping' ). "' /></form>";
- echo "</td></tr>";
- }
- echo '</table>';
- }
-}
-
-function dm_admin_page() {
- global $wpdb, $current_site;
- if ( false == is_site_admin() ) { // paranoid? moi?
- return false;
- }
-
- dm_sunrise_warning();
-
- if ( $current_site->path != "/" ) {
- wp_die( sprintf( __( "<strong>Warning!</strong> This plugin will only
work if WordPress is installed in the root directory of your webserver. It
is currently installed in &#8217;%s&#8217;.", "wordpress-mu-domain-mapping"
), $current_site->path ) );
- }
-
- // set up some defaults
- if ( get_site_option( 'dm_remote_login', 'NA' ) == 'NA' )
- add_site_option( 'dm_remote_login', 1 );
- if ( get_site_option( 'dm_redirect_admin', 'NA' ) == 'NA' )
- add_site_option( 'dm_redirect_admin', 1 );
- if ( get_site_option( 'dm_user_settings', 'NA' ) == 'NA' )
- add_site_option( 'dm_user_settings', 1 );
-
- if ( !empty( $_POST[ 'action' ] ) ) {
- check_admin_referer( 'domain_mapping' );
- if ( $_POST[ 'action' ] == 'update' ) {
- add_site_option( 'dm_ipaddress', $_POST[ 'ipaddress' ] );
- if ( intval( $_POST[ 'always_redirect_admin' ] ) == 0 )
- $_POST[ 'dm_remote_login' ] = 0; // disable remote login if
redirecting to mapped domain
- add_site_option( 'dm_remote_login', intval( $_POST[ 'dm_remote_login' ]
) );
- add_site_option( 'dm_cname', stripslashes( $_POST[ 'cname' ] ) );
- add_site_option( 'dm_301_redirect', intval(
$_POST[ 'permanent_redirect' ] ) );
- add_site_option( 'dm_redirect_admin', intval(
$_POST[ 'always_redirect_admin' ] ) );
- add_site_option( 'dm_user_settings', intval( $_POST[ 'dm_user_settings'
] ) );
- }
- }
-
- echo '<h3>' . __( 'Domain Mapping
Configuration', 'wordpress-mu-domain-mapping' ) . '</h3>';
- echo '<form method="POST">';
- echo '<input type="hidden" name="action" value="update" />';
- echo "<p>" . __( "As a super admin on this network you can set the IP
address users need to point their DNS A records at <em>or</em> the domain
to point CNAME record at. If you don't know what the IP address is, ping
this blog to get it.", 'wordpress-mu-domain-mapping' ) . "</p>";
- echo "<p>" . __( "If you use round robin DNS or another load balancing
technique with more than one IP, enter each address, separating them by
commas.", 'wordpress-mu-domain-mapping' ) . "</p>";
- _e( "Server IP Address: ", 'wordpress-mu-domain-mapping' );
- echo "<input type='text' name='ipaddress' value='" .
get_site_option( 'dm_ipaddress' ) . "' /><br />";
-
- // Using a CNAME is a safer method than using IP adresses for some people
(IMHO)
- echo "<p>" . __( "If you prefer the use of a CNAME record, you can set
the domain here. This domain must be configured with an A record or ANAME
pointing at an IP address. Visitors may experience problems if it is a
CNAME of another domain.", 'wordpress-mu-domain-mapping' ) . "</p>";
- echo "<p>" . __( "NOTE, this voids the use of any IP address set
above", 'wordpress-mu-domain-mapping' ) . "</p>";
- _e( "Server CNAME domain: ", 'wordpress-mu-domain-mapping' );
- echo "<input type='text' name='cname' value='" .
get_site_option( 'dm_cname' ) . "' /><br />";
- echo '<p>' . __( 'The information you enter here will be shown to your
users so they can configure their DNS correctly. It is for informational
purposes only', 'wordpress-mu-domain-mapping' ) . '</p>';
-
- echo "<h3>" . __( 'Domain Options', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo "<ol><li><input type='checkbox' name='dm_remote_login' value='1' ";
- echo get_site_option( 'dm_remote_login' ) == 1 ? "checked='checked'" : "";
- echo " /> " . __( 'Remote Login', 'wordpress-mu-domain-mapping'
) . "</li>";
- echo "<li><input type='checkbox' name='permanent_redirect' value='1' ";
- echo get_site_option( 'dm_301_redirect' ) == 1 ? "checked='checked'" : "";
- echo " /> " . __( "Permanent redirect (better for your blogger's
pagerank)", 'wordpress-mu-domain-mapping' ) . "</li>";
- echo "<li><input type='checkbox' name='dm_user_settings' value='1' ";
- echo get_site_option( 'dm_user_settings' ) ==
1 ? "checked='checked'" : "";
- echo " /> " . __( 'User domain mapping
page', 'wordpress-mu-domain-mapping' ) . "</li> ";
- echo "<li><input type='checkbox' name='always_redirect_admin' value='1' ";
- echo get_site_option( 'dm_redirect_admin' ) ==
1 ? "checked='checked'" : "";
- echo " /> " . __( "Redirect administration pages to site's original
domain (remote login disabled if redirect
disabled)", 'wordpress-mu-domain-mapping' ) . "</li></ol>";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit' value='" .
__( "Save", 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
-}
-
-function dm_handle_actions() {
- global $wpdb;
- if ( !empty( $_POST[ 'action' ] ) ) {
- $domain = $wpdb->escape( $_POST[ 'domain' ] );
- if ( $domain == '' ) {
- wp_die( "You must enter a domain" );
- }
- check_admin_referer( 'domain_mapping' );
- do_action('dm_handle_actions_init', $domain);
- switch( $_POST[ 'action' ] ) {
- case "add":
- do_action('dm_handle_actions_add', $domain);
- if( null == $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blogs} WHERE
domain = '$domain'" ) && null == $wpdb->get_row( "SELECT blog_id FROM
{$wpdb->dmtable} WHERE domain = '$domain'" ) ) {
- if ( $_POST[ 'primary' ] ) {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active =
0 WHERE blog_id = %d", $wpdb->blogid ) );
- }
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} ( `id` ,
`blog_id` , `domain` , `active` ) VALUES ( NULL, %d, %s, %d )",
$wpdb->blogid, $domain, $_POST[ 'primary' ] ) );
- wp_redirect( '?page=domainmapping&updated=add' );
- exit;
- } else {
- wp_redirect( '?page=domainmapping&updated=exists' );
- exit;
- }
- break;
- case "primary":
- do_action('dm_handle_actions_primary', $domain);
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = 0
WHERE blog_id = %d", $wpdb->blogid ) );
- $orig_url = parse_url( get_original_url( 'siteurl' ) );
- if( $domain != $orig_url[ 'host' ] ) {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = 1
WHERE domain = %s", $domain ) );
- }
- wp_redirect( '?page=domainmapping&updated=primary' );
- exit;
- break;
- }
- } elseif( $_GET[ 'action' ] == 'delete' ) {
- $domain = $wpdb->escape( $_GET[ 'domain' ] );
- if ( $domain == '' ) {
- wp_die( __( "You must enter a domain", 'wordpress-mu-domain-mapping' )
);
- }
- check_admin_referer( "delete" . $_GET['domain'] );
- do_action('dm_handle_actions_del', $domain);
- $wpdb->query( "DELETE FROM {$wpdb->dmtable} WHERE domain = '$domain'" );
- wp_redirect( '?page=domainmapping&updated=del' );
- exit;
- }
-
-}
-if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'domainmapping' )
- add_action( 'admin_init', 'dm_handle_actions' );
-
-function dm_sunrise_warning( $die = true ) {
- if ( !file_exists( ABSPATH . '/wp-content/sunrise.php' ) ) {
- if ( !$die )
- return true;
-
- if ( is_site_admin() ) {
- wp_die( sprintf( __( "Please copy sunrise.php
to %s/wp-content/sunrise.php and ensure the SUNRISE definition is
in %swp-config.php", 'wordpress-mu-domain-mapping' ), ABSPATH, ABSPATH ) );
- } else {
- wp_die( __( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' ) );
- }
- return true;
- } elseif ( !defined( 'SUNRISE' ) ) {
- if ( !$die )
- return true;
-
- if ( is_site_admin() ) {
- wp_die( sprintf( __( "Please uncomment the line
<em>define( 'SUNRISE', 'on' );</em> or add it to
your %swp-config.php", 'wordpress-mu-domain-mapping' ), ABSPATH ) );
- } else {
- wp_die( __( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' ) );
- }
- return true;
- }
- return false;
-}
-
-
-function dm_manage_page() {
- global $wpdb;
-
- if ( isset( $_GET[ 'updated' ] ) ) {
- do_action('dm_echo_updated_msg');
- }
-
- dm_sunrise_warning();
-
- echo "<div class='wrap'><h2>" . __( 'Domain
Mapping', 'wordpress-mu-domain-mapping' ) . "</h2>";
-
- if ( false == get_site_option( 'dm_ipaddress' ) && false ==
get_site_option( 'dm_cname' ) ) {
- if ( is_site_admin() ) {
- _e( "Please set the IP address or CNAME of your server in the <a
href='wpmu-admin.php?page=dm_admin_page'>site admin
page</a>.", 'wordpress-mu-domain-mapping' );
- } else {
- _e( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' );
- }
- echo "</div>";
- return false;
- }
-
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $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 );
- echo "<h3>" . __( 'Active domains on this
blog', 'wordpress-mu-domain-mapping' ) . "</h3>";
- 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";
- $primary_found = 0;
- echo '<form method="POST">';
- foreach( $domains as $details ) {
- if ( 0 == $primary_found && $details[ 'domain' ] == $orig_url[ 'host' ]
) {
- $details[ 'active' ] = 1;
- }
- echo "<tr><td>";
- echo "<input type='radio' name='domain' value='{$details[ 'domain'
]}' ";
- if ( $details[ 'active' ] == 1 )
- echo "checked='1' ";
- echo "/>";
- $url = "{$protocol}{$details[ 'domain' ]}{$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( "?page=domainmapping&action=delete&domain={$details[ 'domain'
]}", "delete" . $details[ 'domain' ] ) . "'>" .
__( 'Del', 'wordpress-mu-domain-mapping' ) . "</a>";
- }
- echo "</td></tr>";
- if ( 0 == $primary_found )
- $primary_found = $details[ 'active' ];
- }
- ?></table><?php
- echo '<input type="hidden" name="action" value="primary" />';
- echo "<input type='submit' value='" . __( 'Set Primary
Domain', 'wordpress-mu-domain-mapping' ) . "' />";
- wp_nonce_field( 'domain_mapping' );
- echo "</form>";
- echo "<p>" . __( "* The primary domain cannot be
deleted.", 'wordpress-mu-domain-mapping' ) . "</p>";
- }
- echo "<h3>" . __( 'Add new domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo '<form method="POST">';
- echo '<input type="hidden" name="action" value="add" />';
- echo "http://<input type='text' name='domain' value='' />/<br />";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='checkbox' name='primary' value='1' /> " . __( 'Primary
domain for this blog', 'wordpress-mu-domain-mapping' ) . "<br />";
- echo "<input type='submit' value='" .
__( "Add", 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
-
- if ( get_site_option( 'dm_cname' ) ) {
- $dm_cname = get_site_option( 'dm_cname');
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add a DNS "CNAME" record pointing to the following domain name for
this server: <strong>%s</strong>', 'wordpress-mu-domain-mapping' ),
$dm_cname ) . "</p>";
- echo "<p>" . __( 'Google have published <a
href="http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317"
target="_blank">instructions</a> for creating CNAME records on various
hosting platforms such as GoDaddy and
others.', 'wordpress-mu-domain-mapping' ) . "</p>";
- } else {
- echo "<p>" . __( 'If your domain name includes a hostname
like "www", "blog" or some other prefix before the actual domain name you
will need to add a CNAME for that hostname in your DNS pointing at this
blog URL.', 'wordpress-mu-domain-mapping' ) . "</p>";
- $dm_ipaddress = get_site_option( 'dm_ipaddress', 'IP not set by admin
yet.' );
- if ( strpos( $dm_ipaddress, ',' ) ) {
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add DNS "A" records pointing at the IP addresses of this server:
<strong>%s</strong>', 'wordpress-mu-domain-mapping' ), $dm_ipaddress
) . "</p>";
- } else {
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add a DNS "A" record pointing at the IP address of this server:
<strong>%s</strong>', 'wordpress-mu-domain-mapping' ), $dm_ipaddress
) . "</p>";
- }
- }
- echo "</div>";
-}
-
-function domain_mapping_siteurl( $setting ) {
- global $wpdb, $current_blog;
-
- // To reduce the number of database queries, save the results the first
time we encounter each blog ID.
- static $return_url = array();
-
- if ( !isset( $return_url[ $wpdb->blogid ] ) ) {
- $s = $wpdb->suppress_errors();
-
- // get primary domain, if we don't have one then return original url.
- $domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE
blog_id = '{$wpdb->blogid}' AND active = 1 LIMIT 1" );
- if ( null == $domain ) {
- $return_url[ $wpdb->blogid ] = untrailingslashit(
get_original_url( "siteurl" ) );
- return $return_url[ $wpdb->blogid ];
- }
-
- $wpdb->suppress_errors( $s );
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- if ( $domain ) {
- $return_url[ $wpdb->blogid ] = untrailingslashit( $protocol . $domain
);
- $setting = $return_url[ $wpdb->blogid ];
- } else {
- $return_url[ $wpdb->blogid ] = false;
- }
- } elseif ( $return_url[ $wpdb->blogid ] !== FALSE) {
- $setting = $return_url[ $wpdb->blogid ];
- }
-
- return $setting;
-}
-
-// url is siteurl or home
-function get_original_url( $url, $blog_id = 0 ) {
- global $wpdb;
-
- if ( $blog_id != 0 ) {
- $id = $blog_id;
- } else {
- $id = $wpdb->blogid;
- }
-
- static $orig_urls = array();
- if ( ! isset( $orig_urls[ $id ] ) ) {
- if ( defined( 'DOMAIN_MAPPING' ) )
- remove_filter( 'pre_option_' . $url, 'domain_mapping_' . $url );
- if ( $blog_id == 0 ) {
- $orig_url = get_option( $url );
- } else {
- $orig_url = get_blog_option( $blog_id, $url );
- }
- if ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS'
] ) ) {
- $orig_url = str_replace( "http://", "https://", $orig_url );
- } else {
- $orig_url = str_replace( "https://", "http://", $orig_url );
- }
- if ( $blog_id == 0 ) {
- $orig_urls[ $wpdb->blogid ] = $orig_url;
- } else {
- $orig_urls[ $blog_id ] = $orig_url;
- }
- if ( defined( 'DOMAIN_MAPPING' ) )
- add_filter( 'pre_option_' . $url, 'domain_mapping_' . $url );
- }
- return $orig_urls[ $id ];
-}
-
-function domain_mapping_adminurl( $url, $path, $blog_id = 0 ) {
- $index = strpos( $url, '/wp-admin' );
- if( $index !== false )
- $url = get_original_url( 'siteurl', $blog_id ) . substr( $url, $index );
- return $url;
-}
-
-function domain_mapping_post_content( $post_content ) {
- global $wpdb;
-
- $orig_url = get_original_url( 'siteurl' );
-
- $url = domain_mapping_siteurl( 'NA' );
- if ( $url == 'NA' )
- return $post_content;
- return str_replace( $orig_url, $url, $post_content );
-}
-
-function dm_redirect_admin() {
- if ( get_site_option( 'dm_redirect_admin' ) ) {
- // redirect mapped domain admin page to original url
- $url = get_original_url( 'siteurl' );
- if ( false === strpos( $url, $_SERVER[ 'HTTP_HOST' ] ) ) {
- wp_redirect( untrailingslashit( $url ) . $_SERVER[ 'REQUEST_URI' ] );
- exit;
- }
- } else {
- global $current_blog;
- // redirect original url to primary domain wp-admin/ - remote login is
disabled!
- $url = domain_mapping_siteurl( false );
- $request_uri = str_replace( $current_blog->path, '/',
$_SERVER[ 'REQUEST_URI' ] );
- if ( false === strpos( $url, $_SERVER[ 'HTTP_HOST' ] ) ) {
- wp_redirect( str_replace( '//wp-admin', '/wp-admin', trailingslashit(
$url ) . $request_uri ) );
- exit;
- }
- }
-}
-
-function redirect_login_to_orig() {
- if ( !get_site_option( 'dm_remote_login' ) || $_GET[ 'action' ]
== 'logout' || isset( $_GET[ 'loggedout' ] ) ) {
- return false;
- }
- $url = get_original_url( 'siteurl' );
- if ( $url != site_url() ) {
- $url .= "/wp-login.php";
- echo "<script type='text/javascript'>\nwindow.location
= '$url'</script>";
- }
-}
-
-// fixes the plugins_url
-function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL )
{
- return get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url,
PLUGINDIR ) - 1 );
-}
-
-function domain_mapping_themes_uri( $full_url ) {
- return str_replace( get_original_url ( 'siteurl' ), get_option( 'siteurl'
), $full_url );
-}
-
-if ( defined( 'DOMAIN_MAPPING' ) ) {
- add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );
- add_filter( 'theme_root_uri', 'domain_mapping_themes_uri', 1 );
- add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' );
- add_filter( 'pre_option_home', 'domain_mapping_siteurl' );
- add_filter( 'the_content', 'domain_mapping_post_content' );
- add_action( 'wp_head', 'remote_login_js_loader' );
- add_action( 'login_head', 'redirect_login_to_orig' );
- add_action( 'wp_logout', 'remote_logout_loader', 9999 );
-
- add_filter( 'stylesheet_uri', 'domain_mapping_post_content' );
- add_filter( 'stylesheet_directory', 'domain_mapping_post_content' );
- add_filter( 'stylesheet_directory_uri', 'domain_mapping_post_content' );
- add_filter( 'template_directory', 'domain_mapping_post_content' );
- add_filter( 'template_directory_uri', 'domain_mapping_post_content' );
- add_filter( 'plugins_url', 'domain_mapping_post_content' );
-} else {
- if ( $wp_version == '2.9.2' ) {
- add_filter( 'admin_url', 'domain_mapping_adminurl', 10, 2 );
- } else {
- add_filter( 'admin_url', 'domain_mapping_adminurl', 10, 3 );
- }
-}
-add_action( 'admin_init', 'dm_redirect_admin' );
-if ( isset( $_GET[ 'dm' ] ) )
- add_action( 'template_redirect', 'remote_login_js' );
-
-function remote_logout_loader() {
- global $current_site, $current_blog, $wpdb;
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $hash = get_dm_hash();
- $key = md5( time() );
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtablelogins} ( `id`,
`user_id`, `blog_id`, `t` ) VALUES( %s, 0, %d, NOW() )", $key,
$current_blog->blog_id ) );
- wp_redirect( $protocol . $current_site->domain .
$current_site->path . "?dm={$hash}&action=logout&blogid={$current_blog->blog_id}&k={$key}&t=" .
mt_rand() );
- exit;
-}
-
-function redirect_to_mapped_domain() {
- global $current_blog, $wpdb;
- if ( !isset( $_SERVER[ 'HTTPS' ] ) )
- $_SERVER[ 'HTTPS' ] = "off";
- $protocol = ( 'on' == strtolower($_SERVER['HTTPS'])
) ? 'https://' : 'http://';
- $url = domain_mapping_siteurl( false );
- if ( $url && $url != untrailingslashit( $protocol .
$current_blog->domain . $current_blog->path ) ) {
- $redirect = get_site_option( 'dm_301_redirect' ) ? '301' : '302';
- if ( ( defined( 'VHOST' ) && constant( "VHOST" ) != 'yes' ) || (
defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == false
) ) {
- $_SERVER[ 'REQUEST_URI' ] = str_replace( $current_blog->path, '/',
$_SERVER[ 'REQUEST_URI' ] );
- }
- header( "Location: {$url}{$_SERVER[ 'REQUEST_URI' ]}", true, $redirect );
- exit;
- }
-}
-add_action( 'template_redirect', 'redirect_to_mapped_domain' );
-
-function get_dm_hash() {
- $remote_login_hash = get_site_option( 'dm_hash' );
- if ( null == $remote_login_hash ) {
- $remote_login_hash = md5( time() );
- update_site_option( 'dm_hash', $remote_login_hash );
- }
- return $remote_login_hash;
-}
-
-function remote_login_js() {
- global $current_blog, $current_user, $wpdb;
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- $hash = get_dm_hash();
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- if ( $_GET[ 'dm' ] == $hash ) {
- if ( $_GET[ 'action' ] == 'load' ) {
- if ( !is_user_logged_in() )
- exit;
- $key = md5( time() . mt_rand() );
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtablelogins} (
`id`, `user_id`, `blog_id`, `t` ) VALUES( %s, %d, %d, NOW() )", $key,
$current_user->ID, $_GET[ 'blogid' ] ) );
- $url = add_query_arg( array( 'action' => 'login', 'dm' => $hash, 'k' =>
$key, 't' => mt_rand() ), $_GET[ 'back' ] );
- echo "window.location = '$url'";
- exit;
- } elseif ( $_GET[ 'action' ] == 'login' ) {
- if ( $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtablelogins} WHERE id = %s AND blog_id = %d", $_GET[ 'k' ],
$wpdb->blogid ) ) ) {
- if ( $details->blog_id == $wpdb->blogid ) {
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE id = %s", $_GET[ 'k' ] ) );
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE t < %d", ( time() - 120 ) ) ); // remote logins survive for only 2
minutes if not used.
- wp_set_auth_cookie( $details->user_id );
- wp_redirect( remove_query_arg( array( 'dm', 'action', 'k', 't',
$protocol . $current_blog->domain . $_SERVER[ 'REQUEST_URI' ] ) ) );
- exit;
- } else {
- wp_die( __( "Incorrect or out of date login
key", 'wordpress-mu-domain-mapping' ) );
- }
- } else {
- wp_die( __( "Unknown login key", 'wordpress-mu-domain-mapping' ) );
- }
- } elseif ( $_GET[ 'action' ] == 'logout' ) {
- if ( $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtablelogins} WHERE id = %d AND blog_id = %d", $_GET[ 'k' ],
$_GET[ 'blogid' ] ) ) ) {
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE id = %s", $_GET[ 'k' ] ) );
- $blog = get_blog_details( $_GET[ 'blogid' ] );
- wp_clear_auth_cookie();
- wp_redirect( trailingslashit( $blog->siteurl
) . "wp-login.php?loggedout=true" );
- exit;
- } else {
- wp_die( __( "Unknown logout key", 'wordpress-mu-domain-mapping' ) );
- }
- }
- }
-}
-
-function remote_login_js_loader() {
- global $current_site, $current_blog;
- if ( is_user_logged_in() )
- return false;
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $hash = get_dm_hash();
- echo "<script
src='{$protocol}{$current_site->domain}{$current_site->path}?dm={$hash}&amp;action=load&amp;blogid={$current_blog->blog_id}&amp;siteid={$current_blog->site_id}&amp;t=" .
mt_rand() . "&amp;back=" . urlencode( $protocol . $current_blog->domain .
$_SERVER[ 'REQUEST_URI' ] ) . "' type='text/javascript'></script>";
-}
-
-// delete mapping if blog is deleted
-function delete_blog_domain_mapping( $blog_id, $drop ) {
- global $wpdb;
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- if ( $blog_id && $drop ) {
- // Get an array of domain names to pass onto any
delete_blog_domain_mapping actions
- $domains = $wpdb->get_col( $wpdb->prepare( "SELECT domain FROM
{$wpdb->dmtable} WHERE blog_id = %d", $blog_id ) );
- do_action('dm_delete_blog_domain_mappings', $domains);
-
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtable} WHERE
blog_id = %d", $blog_id ) );
- }
-}
-add_action( 'delete_blog', 'delete_blog_domain_mapping', 1, 2 );
-
-// show mapping on site admin blogs screen
-function ra_domain_mapping_columns( $columns ) {
- $columns[ 'map' ] = __( 'Mapping' );
- return $columns;
-}
-add_filter( 'wpmu_blogs_columns', 'ra_domain_mapping_columns' );
-
-function ra_domain_mapping_field( $column, $blog_id ) {
- global $wpdb;
- static $maps = false;
-
- if ( $column == 'map' ) {
- if ( $maps === false ) {
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- $work = $wpdb->get_results( "SELECT blog_id, domain FROM
{$wpdb->dmtable} ORDER BY blog_id" );
- $maps = array();
- if($work) {
- foreach( $work as $blog ) {
- $maps[ $blog->blog_id ][] = $blog->domain;
- }
- }
- }
- if(is_array( $maps[ $blog_id ] ) && count( $maps[ $blog_id ] )) {
- foreach( $maps[ $blog_id ] as $blog ) {
- echo $blog . '<br />';
- }
- }
- }
-}
-add_action( 'manage_blogs_custom_column', 'ra_domain_mapping_field', 1, 3
);
-
-?>
=======================================
--- /plugins/wordpress-mu-domain-mapping/trunk/les_meg.txt Thu Jul 1
10:27:27 2010
+++ /dev/null
@@ -1,13 +0,0 @@
-Dette innstikket ble laget for WordPress MU, og er ikke ennå oppdatert.
-
-Det er i tillegg noen feil i domain_mapping.php.
-
-Jeg har derfor midlertidig lagt opp den versjonen jeg bruker her,
-håper at dette retter seg til i fremtidige versjoenr.
-
-Med denne versjonen, legges de oversatte filene i en mappen:
-wp-content/plugins/wordpress-mu-domain-mapping/
-selve innstikket legges (som det står i installasjonsveiledningen) i:
-wp-content/mu-plugins/
-og i tillegg legges altså "sunrise.php" i:
-wp-content/
=======================================
--- /plugins/wordpress-mu-domain-mapping/trunk/domain_mapping.php Thu Jul
1 10:27:27 2010
+++ /dev/null
@@ -1,740 +0,0 @@
-<?php
-/*
-Plugin Name: WordPress MU Domain Mapping
-Plugin URI: http://ocaoimh.ie/wordpress-mu-domain-mapping/
-Description: Map any blog on a WordPress website to another domain.
-Version: 0.5.2
-Author: Donncha O Caoimh
-Author URI: http://ocaoimh.ie/
-*/
-/* Copyright Donncha O Caoimh (http://ocaoimh.ie/)
- With contributions by Ron Rennick(http://wpmututorials.com/), Greg
Sidberry and others.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
-*/
-
-function dm_text_domain() {
- load_plugin_textdomain( 'wordpress-mu-domain-mapping', basename( dirname(
__FILE__ ) ) . 'languages', 'wordpress-mu-domain-mapping/languages' );
-}
-add_action( 'init', 'dm_text_domain' );
-
-function domain_mapping_warning() {
- echo "<div id='domain-mapping-warning' class='updated
fade'><p><strong>".__( 'Domain Mapping
Disabled.', 'wordpress-mu-domain-mapping' )."</strong> ".sprintf(__('You
must <a href="%1$s">create a network</a> for it to
work.', 'wordpress-mu-domain-mapping'
), "http://codex.wordpress.org/Create_A_Network")."</p></div>";
-}
-
-function dm_add_pages() {
- global $current_site, $wpdb, $wp_db_version;
-
- if ( !isset( $current_site ) && $wp_db_version >= 15260 ) { // WP 3.0
network hasn't been configured
- add_action('admin_notices', 'domain_mapping_warning');
- return false;
- }
- if ( $current_site->path != "/" ) {
- wp_die( __( "The domain mapping plugin only works if the site is
installed in /. This is a limitation of how virtual servers work and is
very difficult to work around.", 'wordpress-mu-domain-mapping' ) );
- }
-
- maybe_create_db();
-
- if ( get_site_option( 'dm_user_settings' ) && $current_site->blog_id !=
$wpdb->blogid && !dm_sunrise_warning( false ) ) {
- add_management_page(__( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), 'manage_options', 'domainmapping', 'dm_manage_page'
);
- }
- if( is_site_admin() ) {
- add_submenu_page('wpmu-admin.php', __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), __( 'Domain
Mapping', 'wordpress-mu-domain-mapping'), 'manage_options', 'dm_admin_page', 'dm_admin_page');
- add_submenu_page('wpmu-admin.php',
__( 'Domains', 'wordpress-mu-domain-mapping'),
__( 'Domains', 'wordpress-mu-domain-mapping'), 'manage_options', 'dm_domains_admin', 'dm_domains_admin');
- }
-}
-add_action( 'admin_menu', 'dm_add_pages' );
-
-// Default Messages for the users Domain Mapping management page
-// This can now be replaced by using:
-// remove_action('dm_echo_updated_msg','dm_echo_default_updated_msg');
-// add_action('dm_echo_updated_msg','my_custom_updated_msg_function');
-function dm_echo_default_updated_msg() {
- switch( $_GET[ 'updated' ] ) {
- case "add":
- $msg = __( 'New domain added.', 'wordpress-mu-domain-mapping' );
- break;
- case "exists":
- $msg = __( 'New domain already exists.', 'wordpress-mu-domain-mapping'
);
- break;
- case "primary":
- $msg = __( 'New primary domain.', 'wordpress-mu-domain-mapping' );
- break;
- case "del":
- $msg = __( 'Domain deleted.', 'wordpress-mu-domain-mapping' );
- break;
- }
- echo "<div class='updated fade'><p>$msg</p></div>";
-}
-add_action('dm_echo_updated_msg','dm_echo_default_updated_msg');
-
-function maybe_create_db() {
- global $wpdb;
-
- get_dm_hash(); // initialise the remote login hash
-
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- if ( is_site_admin() ) {
- $created = 0;
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtable}'") !=
$wpdb->dmtable ) {
- $wpdb->query( "CREATE TABLE IF NOT EXISTS `{$wpdb->dmtable}` (
- `id` bigint(20) NOT NULL auto_increment,
- `blog_id` bigint(20) NOT NULL,
- `domain` varchar(255) NOT NULL,
- `active` tinyint(4) default '1',
- PRIMARY KEY (`id`),
- KEY `blog_id` (`blog_id`,`domain`,`active`)
- );" );
- $created = 1;
- }
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtablelogins}'") !=
$wpdb->dmtablelogins ) {
- $wpdb->query( "CREATE TABLE IF NOT EXISTS `{$wpdb->dmtablelogins}` (
- `id` varchar(32) NOT NULL,
- `user_id` bigint(20) NOT NULL,
- `blog_id` bigint(20) NOT NULL,
- `t` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`)
- );" );
- $created = 1;
- }
- if ( $created ) {
- ?> <div id="message" class="updated fade"><p><strong><?php _e( 'Domain
mapping database table created.', 'wordpress-mu-domain-mapping'
) ?></strong></p></div> <?php
- }
- }
-
-}
-
-function dm_domains_admin() {
- global $wpdb, $current_site;
- if ( false == is_site_admin() ) { // paranoid? moi?
- return false;
- }
-
- dm_sunrise_warning();
-
- if ( $current_site->path != "/" ) {
- wp_die( sprintf( __( "<strong>Warning!</strong> This plugin will only
work if WordPress is installed in the root directory of your webserver. It
is currently installed in &#8217;%s&#8217;.", "wordpress-mu-domain-mapping"
), $current_site->path ) );
- }
-
- switch( $_POST[ 'action' ] ) {
- default:
- }
- echo '<h2>' . __( 'Domain Mapping:
Domains', 'wordpress-mu-domain-mapping' ) . '</h2>';
- if ( !empty( $_POST[ 'action' ] ) ) {
- check_admin_referer( 'domain_mapping' );
- switch( $_POST[ 'action' ] ) {
- case "edit":
- $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->dmtable}
WHERE domain = %s", $_POST[ 'domain' ] ) );
- if ( $row ) {
- dm_edit_domain( $row );
- } else {
- echo "<h3>" . __( 'Domain not found', 'wordpress-mu-domain-mapping'
) . "</h3>";
- }
- break;
- case "save":
- if ( $_POST[ 'blog_id' ] != 0 AND
- $_POST[ 'blog_id' ] != 1 AND
- null == $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM
{$wpdb->dmtable} WHERE blog_id != %d AND domain = %s", $_POST[ 'blog_id' ],
$_POST[ 'domain' ] ) )
- ) {
- if ( $_POST[ 'orig_domain' ] == '' ) {
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} (
`blog_id`, `domain`, `active` ) VALUES ( %d, %s, %d )", $_POST[ 'blog_id'
], $_POST[ 'domain' ], $_POST[ 'active' ] ) );
- echo "<p><strong>" . __( 'Domain Add', 'wordpress-mu-domain-mapping'
) . "</strong></p>";
- } else {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET blog_id
= %d, domain = %s, active = %d WHERE domain = %s", $_POST[ 'blog_id' ],
$_POST[ 'domain' ], $_POST[ 'active' ], $_POST[ 'orig_domain' ] ) );
- echo "<p><strong>" . __( 'Domain
Updated', 'wordpress-mu-domain-mapping' ) . "</strong></p>";
- }
- }
- break;
- case "del":
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtable} WHERE
domain = %s", $_POST[ 'domain' ] ) );
- echo "<p><strong>" . __( 'Domain
Deleted', 'wordpress-mu-domain-mapping' ) . "</strong></p>";
- break;
- case "search":
- $rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtable} WHERE domain LIKE %s", $_POST[ 'domain' ] ) );
- dm_domain_listing( $rows, sprintf( __( "Searching
for %s", 'wordpress-mu-domain-mapping' ), $_POST[ 'domain' ] ) );
- break;
- }
- if ( $_POST[ 'action' ] == 'update' ) {
- add_site_option( 'dm_ipaddress', $_POST[ 'ipaddress' ] );
- add_site_option( 'dm_cname', $_POST[ 'cname' ] );
- add_site_option( 'dm_301_redirect', intval(
$_POST[ 'permanent_redirect' ] ) );
- }
- }
-
- echo "<h3>" . __( 'Search Domains', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo '<form method="POST">';
- wp_nonce_field( 'domain_mapping' );
- echo '<input type="hidden" name="action" value="search" />';
- echo _e( "Domain:", 'wordpress-mu-domain-mapping' );
- echo " <input type='text' name='domain' value='' /><br />";
- echo "<input type='submit' value='" .
__( 'Search', 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
- dm_edit_domain();
- $rows = $wpdb->get_results( "SELECT * FROM {$wpdb->dmtable} ORDER BY id
DESC LIMIT 0,20" );
- dm_domain_listing( $rows );
-}
-
-function dm_edit_domain( $row = false ) {
- if ( is_object( $row ) ) {
- echo "<h3>" . __( 'Edit Domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- } else {
- echo "<h3>" . __( 'New Domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- $row->blog_id = '';
- $row->domain = '';
- $_POST[ 'domain' ] = '';
- $row->active = 1;
- }
-
- echo "<form method='POST'><input type='hidden' name='action' value='save'
/><input type='hidden' name='orig_domain' value='{$_POST[ 'domain' ]}' />";
- wp_nonce_field( 'domain_mapping' );
- echo "<table class='form-table'>\n";
- echo "<tr><th>" . __( 'Site ID', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='text' name='blog_id' value='{$row->blog_id}'
/></td></tr>\n";
- echo "<tr><th>" . __( 'Domain', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='text' name='domain' value='{$row->domain}'
/></td></tr>\n";
- echo "<tr><th>" . __( 'Primary', 'wordpress-mu-domain-mapping'
) . "</th><td><input type='checkbox' name='active' value='1' ";
- echo $row->active == 1 ? 'checked=1 ' : ' ';
- echo "/></td></tr>\n";
- echo "</table>";
- echo "<input type='submit'
value='" .__( 'Save', 'wordpress-mu-domain-mapping' ). "' /></form><br
/><br />";
-}
-
-function dm_domain_listing( $rows, $heading = '' ) {
- if ( $rows ) {
- if ( $heading != '' )
- echo "<h3>$heading</h3>";
- echo '<table class="widefat" cellspacing="0"><thead><tr><th>'.__( 'Site
ID', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Domain', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Primary', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Edit', 'wordpress-mu-domain-mapping'
).'</th><th>'.__( 'Delete', 'wordpress-mu-domain-mapping'
).'</th></tr></thead><tbody>';
- foreach( $rows as $row ) {
- echo "<tr><td><a
href='wpmu-blogs.php?action=editblog&id={$row->blog_id}'>{$row->blog_id}</a></td><td><a
href='http://{$row->domain}/'>{$row->domain}</a></td><td>";
- echo $row->active == 1 ? __( 'Yes', 'wordpress-mu-domain-mapping' ) :
__( 'No', 'wordpress-mu-domain-mapping' );
- echo "</td><td><form method='POST'><input type='hidden' name='action'
value='edit' /><input type='hidden' name='domain' value='{$row->domain}'
/>";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit'
value='" .__( 'Edit', 'wordpress-mu-domain-mapping' ). "'
/></form></td><td><form method='POST'><input type='hidden' name='action'
value='del' /><input type='hidden' name='domain' value='{$row->domain}' />";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit'
value='" .__( 'Del', 'wordpress-mu-domain-mapping' ). "' /></form>";
- echo "</td></tr>";
- }
- echo '</table>';
- }
-}
-
-function dm_admin_page() {
- global $wpdb, $current_site;
- if ( false == is_site_admin() ) { // paranoid? moi?
- return false;
- }
-
- dm_sunrise_warning();
-
- if ( $current_site->path != "/" ) {
- wp_die( sprintf( __( "<strong>Warning!</strong> This plugin will only
work if WordPress is installed in the root directory of your webserver. It
is currently installed in &#8217;%s&#8217;.", "wordpress-mu-domain-mapping"
), $current_site->path ) );
- }
-
- // set up some defaults
- if ( get_site_option( 'dm_remote_login', 'NA' ) == 'NA' )
- add_site_option( 'dm_remote_login', 1 );
- if ( get_site_option( 'dm_redirect_admin', 'NA' ) == 'NA' )
- add_site_option( 'dm_redirect_admin', 1 );
- if ( get_site_option( 'dm_user_settings', 'NA' ) == 'NA' )
- add_site_option( 'dm_user_settings', 1 );
-
- if ( !empty( $_POST[ 'action' ] ) ) {
- check_admin_referer( 'domain_mapping' );
- if ( $_POST[ 'action' ] == 'update' ) {
- add_site_option( 'dm_ipaddress', $_POST[ 'ipaddress' ] );
- if ( intval( $_POST[ 'always_redirect_admin' ] ) == 0 )
- $_POST[ 'dm_remote_login' ] = 0; // disable remote login if
redirecting to mapped domain
- add_site_option( 'dm_remote_login', intval( $_POST[ 'dm_remote_login' ]
) );
- add_site_option( 'dm_cname', stripslashes( $_POST[ 'cname' ] ) );
- add_site_option( 'dm_301_redirect', intval(
$_POST[ 'permanent_redirect' ] ) );
- add_site_option( 'dm_redirect_admin', intval(
$_POST[ 'always_redirect_admin' ] ) );
- add_site_option( 'dm_user_settings', intval( $_POST[ 'dm_user_settings'
] ) );
- }
- }
-
- echo '<h3>' . __( 'Domain Mapping
Configuration', 'wordpress-mu-domain-mapping' ) . '</h3>';
- echo '<form method="POST">';
- echo '<input type="hidden" name="action" value="update" />';
- echo "<p>" . __( "As a super admin on this network you can set the IP
address users need to point their DNS A records at <em>or</em> the domain
to point CNAME record at. If you don't know what the IP address is, ping
this blog to get it.", 'wordpress-mu-domain-mapping' ) . "</p>";
- echo "<p>" . __( "If you use round robin DNS or another load balancing
technique with more than one IP, enter each address, separating them by
commas.", 'wordpress-mu-domain-mapping' ) . "</p>";
- _e( "Server IP Address: ", 'wordpress-mu-domain-mapping' );
- echo "<input type='text' name='ipaddress' value='" .
get_site_option( 'dm_ipaddress' ) . "' /><br />";
-
- // Using a CNAME is a safer method than using IP adresses for some people
(IMHO)
- echo "<p>" . __( "If you prefer the use of a CNAME record, you can set
the domain here. This domain must be configured with an A record or ANAME
pointing at an IP address. Visitors may experience problems if it is a
CNAME of another domain.", 'wordpress-mu-domain-mapping' ) . "</p>";
- echo "<p>" . __( "NOTE, this voids the use of any IP address set
above", 'wordpress-mu-domain-mapping' ) . "</p>";
- _e( "Server CNAME domain: ", 'wordpress-mu-domain-mapping' );
- echo "<input type='text' name='cname' value='" .
get_site_option( 'dm_cname' ) . "' /><br />";
- echo '<p>' . __( 'The information you enter here will be shown to your
users so they can configure their DNS correctly. It is for informational
purposes only', 'wordpress-mu-domain-mapping' ) . '</p>';
-
- echo "<h3>" . __( 'Domain Options', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo "<ol><li><input type='checkbox' name='dm_remote_login' value='1' ";
- echo get_site_option( 'dm_remote_login' ) == 1 ? "checked='checked'" : "";
- echo " /> " . __( 'Remote Login', 'wordpress-mu-domain-mapping'
) . "</li>";
- echo "<li><input type='checkbox' name='permanent_redirect' value='1' ";
- echo get_site_option( 'dm_301_redirect' ) == 1 ? "checked='checked'" : "";
- echo " /> " . __( "Permanent redirect (better for your blogger's
pagerank)", 'wordpress-mu-domain-mapping' ) . "</li>";
- echo "<li><input type='checkbox' name='dm_user_settings' value='1' ";
- echo get_site_option( 'dm_user_settings' ) ==
1 ? "checked='checked'" : "";
- echo " /> " . __( 'User domain mapping
page', 'wordpress-mu-domain-mapping' ) . "</li> ";
- echo "<li><input type='checkbox' name='always_redirect_admin' value='1' ";
- echo get_site_option( 'dm_redirect_admin' ) ==
1 ? "checked='checked'" : "";
- echo " /> " . __( "Redirect administration pages to site's original
domain (remote login disabled if redirect
disabled)", 'wordpress-mu-domain-mapping' ) . "</li></ol>";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='submit' value='" .
__( "Save", 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
-}
-
-function dm_handle_actions() {
- global $wpdb;
- if ( !empty( $_POST[ 'action' ] ) ) {
- $domain = $wpdb->escape( $_POST[ 'domain' ] );
- if ( $domain == '' ) {
- wp_die( "You must enter a domain" );
- }
- check_admin_referer( 'domain_mapping' );
- do_action('dm_handle_actions_init', $domain);
- switch( $_POST[ 'action' ] ) {
- case "add":
- do_action('dm_handle_actions_add', $domain);
- if( null == $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blogs} WHERE
domain = '$domain'" ) && null == $wpdb->get_row( "SELECT blog_id FROM
{$wpdb->dmtable} WHERE domain = '$domain'" ) ) {
- if ( $_POST[ 'primary' ] ) {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active =
0 WHERE blog_id = %d", $wpdb->blogid ) );
- }
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtable} ( `id` ,
`blog_id` , `domain` , `active` ) VALUES ( NULL, %d, %s, %d )",
$wpdb->blogid, $domain, $_POST[ 'primary' ] ) );
- wp_redirect( '?page=domainmapping&updated=add' );
- exit;
- } else {
- wp_redirect( '?page=domainmapping&updated=exists' );
- exit;
- }
- break;
- case "primary":
- do_action('dm_handle_actions_primary', $domain);
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = 0
WHERE blog_id = %d", $wpdb->blogid ) );
- $orig_url = parse_url( get_original_url( 'siteurl' ) );
- if( $domain != $orig_url[ 'host' ] ) {
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->dmtable} SET active = 1
WHERE domain = %s", $domain ) );
- }
- wp_redirect( '?page=domainmapping&updated=primary' );
- exit;
- break;
- }
- } elseif( $_GET[ 'action' ] == 'delete' ) {
- $domain = $wpdb->escape( $_GET[ 'domain' ] );
- if ( $domain == '' ) {
- wp_die( __( "You must enter a domain", 'wordpress-mu-domain-mapping' )
);
- }
- check_admin_referer( "delete" . $_GET['domain'] );
- do_action('dm_handle_actions_del', $domain);
- $wpdb->query( "DELETE FROM {$wpdb->dmtable} WHERE domain = '$domain'" );
- wp_redirect( '?page=domainmapping&updated=del' );
- exit;
- }
-
-}
-if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'domainmapping' )
- add_action( 'admin_init', 'dm_handle_actions' );
-
-function dm_sunrise_warning( $die = true ) {
- if ( !file_exists( ABSPATH . '/wp-content/sunrise.php' ) ) {
- if ( !$die )
- return true;
-
- if ( is_site_admin() ) {
- wp_die( sprintf( __( "Please copy sunrise.php
to %s/wp-content/sunrise.php and ensure the SUNRISE definition is
in %swp-config.php", 'wordpress-mu-domain-mapping' ), ABSPATH, ABSPATH ) );
- } else {
- wp_die( __( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' ) );
- }
- return true;
- } elseif ( !defined( 'SUNRISE' ) ) {
- if ( !$die )
- return true;
-
- if ( is_site_admin() ) {
- wp_die( sprintf( __( "Please uncomment the line
<em>define( 'SUNRISE', 'on' );</em> or add it to
your %swp-config.php", 'wordpress-mu-domain-mapping' ), ABSPATH ) );
- } else {
- wp_die( __( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' ) );
- }
- return true;
- }
- return false;
-}
-
-
-function dm_manage_page() {
- global $wpdb;
-
- if ( isset( $_GET[ 'updated' ] ) ) {
- do_action('dm_echo_updated_msg');
- }
-
- dm_sunrise_warning();
-
- echo "<div class='wrap'><h2>" . __( 'Domain
Mapping', 'wordpress-mu-domain-mapping' ) . "</h2>";
-
- if ( false == get_site_option( 'dm_ipaddress' ) && false ==
get_site_option( 'dm_cname' ) ) {
- if ( is_site_admin() ) {
- _e( "Please set the IP address or CNAME of your server in the <a
href='wpmu-admin.php?page=dm_admin_page'>site admin
page</a>.", 'wordpress-mu-domain-mapping' );
- } else {
- _e( "This plugin has not been configured correctly
yet.", 'wordpress-mu-domain-mapping' );
- }
- echo "</div>";
- return false;
- }
-
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $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 );
- echo "<h3>" . __( 'Active domains on this
blog', 'wordpress-mu-domain-mapping' ) . "</h3>";
- 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";
- $primary_found = 0;
- echo '<form method="POST">';
- foreach( $domains as $details ) {
- if ( 0 == $primary_found && $details[ 'domain' ] == $orig_url[ 'host' ]
) {
- $details[ 'active' ] = 1;
- }
- echo "<tr><td>";
- echo "<input type='radio' name='domain' value='{$details[ 'domain'
]}' ";
- if ( $details[ 'active' ] == 1 )
- echo "checked='1' ";
- echo "/>";
- $url = "{$protocol}{$details[ 'domain' ]}{$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( "?page=domainmapping&action=delete&domain={$details[ 'domain'
]}", "delete" . $details[ 'domain' ] ) . "'>" .
__( 'Del', 'wordpress-mu-domain-mapping' ) . "</a>";
- }
- echo "</td></tr>";
- if ( 0 == $primary_found )
- $primary_found = $details[ 'active' ];
- }
- ?></table><?php
- echo '<input type="hidden" name="action" value="primary" />';
- echo "<input type='submit' value='" . __( 'Set Primary
Domain', 'wordpress-mu-domain-mapping' ) . "' />";
- wp_nonce_field( 'domain_mapping' );
- echo "</form>";
- echo "<p>" . __( "* The primary domain cannot be
deleted.", 'wordpress-mu-domain-mapping' ) . "</p>";
- }
- echo "<h3>" . __( 'Add new domain', 'wordpress-mu-domain-mapping'
) . "</h3>";
- echo '<form method="POST">';
- echo '<input type="hidden" name="action" value="add" />';
- echo "http://<input type='text' name='domain' value='' />/<br />";
- wp_nonce_field( 'domain_mapping' );
- echo "<input type='checkbox' name='primary' value='1' /> " . __( 'Primary
domain for this blog', 'wordpress-mu-domain-mapping' ) . "<br />";
- echo "<input type='submit' value='" .
__( "Add", 'wordpress-mu-domain-mapping' ) . "' />";
- echo "</form><br />";
-
- if ( get_site_option( 'dm_cname' ) ) {
- $dm_cname = get_site_option( 'dm_cname');
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add a DNS "CNAME" record pointing to the following domain name for
this server: <strong>%s</strong>', 'wordpress-mu-domain-mapping' ),
$dm_cname ) . "</p>";
- echo "<p>" . __( 'Google have published <a
href="http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317"
target="_blank">instructions</a> for creating CNAME records on various
hosting platforms such as GoDaddy and
others.', 'wordpress-mu-domain-mapping' ) . "</p>";
- } else {
- echo "<p>" . __( 'If your domain name includes a hostname
like "www", "blog" or some other prefix before the actual domain name you
will need to add a CNAME for that hostname in your DNS pointing at this
blog URL.', 'wordpress-mu-domain-mapping' ) . "</p>";
- $dm_ipaddress = get_site_option( 'dm_ipaddress', 'IP not set by admin
yet.' );
- if ( strpos( $dm_ipaddress, ',' ) ) {
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add DNS "A" records pointing at the IP addresses of this server:
<strong>%s</strong>', 'wordpress-mu-domain-mapping' ), $dm_ipaddress
) . "</p>";
- } else {
- echo "<p>" . sprintf( __( 'If you want to redirect a domain you will
need to add a DNS "A" record pointing at the IP address of this server:
<strong>%s</strong>', 'wordpress-mu-domain-mapping' ), $dm_ipaddress
) . "</p>";
- }
- }
- echo "</div>";
-}
-
-function domain_mapping_siteurl( $setting ) {
- global $wpdb, $current_blog;
-
- // To reduce the number of database queries, save the results the first
time we encounter each blog ID.
- static $return_url = array();
-
- if ( !isset( $return_url[ $wpdb->blogid ] ) ) {
- $s = $wpdb->suppress_errors();
-
- // get primary domain, if we don't have one then return original url.
- $domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE
blog_id = '{$wpdb->blogid}' AND active = 1 LIMIT 1" );
- if ( null == $domain ) {
- $return_url[ $wpdb->blogid ] = untrailingslashit(
get_original_url( "siteurl" ) );
- return $return_url[ $wpdb->blogid ];
- }
-
- $wpdb->suppress_errors( $s );
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- if ( $domain ) {
- $return_url[ $wpdb->blogid ] = untrailingslashit( $protocol . $domain
);
- $setting = $return_url[ $wpdb->blogid ];
- } else {
- $return_url[ $wpdb->blogid ] = false;
- }
- } elseif ( $return_url[ $wpdb->blogid ] !== FALSE) {
- $setting = $return_url[ $wpdb->blogid ];
- }
-
- return $setting;
-}
-
-// url is siteurl or home
-function get_original_url( $url, $blog_id = 0 ) {
- global $wpdb;
-
- if ( $blog_id != 0 ) {
- $id = $blog_id;
- } else {
- $id = $wpdb->blogid;
- }
-
- static $orig_urls = array();
- if ( ! isset( $orig_urls[ $id ] ) ) {
- if ( defined( 'DOMAIN_MAPPING' ) )
- remove_filter( 'pre_option_' . $url, 'domain_mapping_' . $url );
- if ( $blog_id == 0 ) {
- $orig_url = get_option( $url );
- } else {
- $orig_url = get_blog_option( $blog_id, $url );
- }
- if ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS'
] ) ) {
- $orig_url = str_replace( "http://", "https://", $orig_url );
- } else {
- $orig_url = str_replace( "https://", "http://", $orig_url );
- }
- if ( $blog_id == 0 ) {
- $orig_urls[ $wpdb->blogid ] = $orig_url;
- } else {
- $orig_urls[ $blog_id ] = $orig_url;
- }
- if ( defined( 'DOMAIN_MAPPING' ) )
- add_filter( 'pre_option_' . $url, 'domain_mapping_' . $url );
- }
- return $orig_urls[ $id ];
-}
-
-function domain_mapping_adminurl( $url, $path, $blog_id = 0 ) {
- $index = strpos( $url, '/wp-admin' );
- if( $index !== false )
- $url = get_original_url( 'siteurl', $blog_id ) . substr( $url, $index );
- return $url;
-}
-
-function domain_mapping_post_content( $post_content ) {
- global $wpdb;
-
- $orig_url = get_original_url( 'siteurl' );
-
- $url = domain_mapping_siteurl( 'NA' );
- if ( $url == 'NA' )
- return $post_content;
- return str_replace( $orig_url, $url, $post_content );
-}
-
-function dm_redirect_admin() {
- if ( get_site_option( 'dm_redirect_admin' ) ) {
- // redirect mapped domain admin page to original url
- $url = get_original_url( 'siteurl' );
- if ( false === strpos( $url, $_SERVER[ 'HTTP_HOST' ] ) ) {
- wp_redirect( untrailingslashit( $url ) . $_SERVER[ 'REQUEST_URI' ] );
- exit;
- }
- } else {
- global $current_blog;
- // redirect original url to primary domain wp-admin/ - remote login is
disabled!
- $url = domain_mapping_siteurl( false );
- $request_uri = str_replace( $current_blog->path, '/',
$_SERVER[ 'REQUEST_URI' ] );
- if ( false === strpos( $url, $_SERVER[ 'HTTP_HOST' ] ) ) {
- wp_redirect( str_replace( '//wp-admin', '/wp-admin', trailingslashit(
$url ) . $request_uri ) );
- exit;
- }
- }
-}
-
-function redirect_login_to_orig() {
- if ( !get_site_option( 'dm_remote_login' ) || $_GET[ 'action' ]
== 'logout' || isset( $_GET[ 'loggedout' ] ) ) {
- return false;
- }
- $url = get_original_url( 'siteurl' );
- if ( $url != site_url() ) {
- $url .= "/wp-login.php";
- echo "<script type='text/javascript'>\nwindow.location
= '$url'</script>";
- }
-}
-
-// fixes the plugins_url
-function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL )
{
- return get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url,
PLUGINDIR ) - 1 );
-}
-
-function domain_mapping_themes_uri( $full_url ) {
- return str_replace( get_original_url ( 'siteurl' ), get_option( 'siteurl'
), $full_url );
-}
-
-if ( defined( 'DOMAIN_MAPPING' ) ) {
- add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );
- add_filter( 'theme_root_uri', 'domain_mapping_themes_uri', 1 );
- add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' );
- add_filter( 'pre_option_home', 'domain_mapping_siteurl' );
- add_filter( 'the_content', 'domain_mapping_post_content' );
- add_action( 'wp_head', 'remote_login_js_loader' );
- add_action( 'login_head', 'redirect_login_to_orig' );
- add_action( 'wp_logout', 'remote_logout_loader', 9999 );
-
- add_filter( 'stylesheet_uri', 'domain_mapping_post_content' );
- add_filter( 'stylesheet_directory', 'domain_mapping_post_content' );
- add_filter( 'stylesheet_directory_uri', 'domain_mapping_post_content' );
- add_filter( 'template_directory', 'domain_mapping_post_content' );
- add_filter( 'template_directory_uri', 'domain_mapping_post_content' );
- add_filter( 'plugins_url', 'domain_mapping_post_content' );
-} else {
- if ( $wp_version == '2.9.2' ) {
- add_filter( 'admin_url', 'domain_mapping_adminurl', 10, 2 );
- } else {
- add_filter( 'admin_url', 'domain_mapping_adminurl', 10, 3 );
- }
-}
-add_action( 'admin_init', 'dm_redirect_admin' );
-if ( isset( $_GET[ 'dm' ] ) )
- add_action( 'template_redirect', 'remote_login_js' );
-
-function remote_logout_loader() {
- global $current_site, $current_blog, $wpdb;
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $hash = get_dm_hash();
- $key = md5( time() );
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtablelogins} ( `id`,
`user_id`, `blog_id`, `t` ) VALUES( %s, 0, %d, NOW() )", $key,
$current_blog->blog_id ) );
- wp_redirect( $protocol . $current_site->domain .
$current_site->path . "?dm={$hash}&action=logout&blogid={$current_blog->blog_id}&k={$key}&t=" .
mt_rand() );
- exit;
-}
-
-function redirect_to_mapped_domain() {
- global $current_blog, $wpdb;
- if ( !isset( $_SERVER[ 'HTTPS' ] ) )
- $_SERVER[ 'HTTPS' ] = "off";
- $protocol = ( 'on' == strtolower($_SERVER['HTTPS'])
) ? 'https://' : 'http://';
- $url = domain_mapping_siteurl( false );
- if ( $url && $url != untrailingslashit( $protocol .
$current_blog->domain . $current_blog->path ) ) {
- $redirect = get_site_option( 'dm_301_redirect' ) ? '301' : '302';
- if ( ( defined( 'VHOST' ) && constant( "VHOST" ) != 'yes' ) || (
defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == false
) ) {
- $_SERVER[ 'REQUEST_URI' ] = str_replace( $current_blog->path, '/',
$_SERVER[ 'REQUEST_URI' ] );
- }
- header( "Location: {$url}{$_SERVER[ 'REQUEST_URI' ]}", true, $redirect );
- exit;
- }
-}
-add_action( 'template_redirect', 'redirect_to_mapped_domain' );
-
-function get_dm_hash() {
- $remote_login_hash = get_site_option( 'dm_hash' );
- if ( null == $remote_login_hash ) {
- $remote_login_hash = md5( time() );
- update_site_option( 'dm_hash', $remote_login_hash );
- }
- return $remote_login_hash;
-}
-
-function remote_login_js() {
- global $current_blog, $current_user, $wpdb;
- $wpdb->dmtablelogins = $wpdb->base_prefix . 'domain_mapping_logins';
- $hash = get_dm_hash();
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- if ( $_GET[ 'dm' ] == $hash ) {
- if ( $_GET[ 'action' ] == 'load' ) {
- if ( !is_user_logged_in() )
- exit;
- $key = md5( time() . mt_rand() );
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->dmtablelogins} (
`id`, `user_id`, `blog_id`, `t` ) VALUES( %s, %d, %d, NOW() )", $key,
$current_user->ID, $_GET[ 'blogid' ] ) );
- $url = add_query_arg( array( 'action' => 'login', 'dm' => $hash, 'k' =>
$key, 't' => mt_rand() ), $_GET[ 'back' ] );
- echo "window.location = '$url'";
- exit;
- } elseif ( $_GET[ 'action' ] == 'login' ) {
- if ( $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtablelogins} WHERE id = %s AND blog_id = %d", $_GET[ 'k' ],
$wpdb->blogid ) ) ) {
- if ( $details->blog_id == $wpdb->blogid ) {
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE id = %s", $_GET[ 'k' ] ) );
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE t < %d", ( time() - 120 ) ) ); // remote logins survive for only 2
minutes if not used.
- wp_set_auth_cookie( $details->user_id );
- wp_redirect( remove_query_arg( array( 'dm', 'action', 'k', 't',
$protocol . $current_blog->domain . $_SERVER[ 'REQUEST_URI' ] ) ) );
- exit;
- } else {
- wp_die( __( "Incorrect or out of date login
key", 'wordpress-mu-domain-mapping' ) );
- }
- } else {
- wp_die( __( "Unknown login key", 'wordpress-mu-domain-mapping' ) );
- }
- } elseif ( $_GET[ 'action' ] == 'logout' ) {
- if ( $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM
{$wpdb->dmtablelogins} WHERE id = %d AND blog_id = %d", $_GET[ 'k' ],
$_GET[ 'blogid' ] ) ) ) {
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtablelogins}
WHERE id = %s", $_GET[ 'k' ] ) );
- $blog = get_blog_details( $_GET[ 'blogid' ] );
- wp_clear_auth_cookie();
- wp_redirect( trailingslashit( $blog->siteurl
) . "wp-login.php?loggedout=true" );
- exit;
- } else {
- wp_die( __( "Unknown logout key", 'wordpress-mu-domain-mapping' ) );
- }
- }
- }
-}
-
-function remote_login_js_loader() {
- global $current_site, $current_blog;
- if ( is_user_logged_in() )
- return false;
- $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] )
) ? 'https://' : 'http://';
- $hash = get_dm_hash();
- echo "<script
src='{$protocol}{$current_site->domain}{$current_site->path}?dm={$hash}&amp;action=load&amp;blogid={$current_blog->blog_id}&amp;siteid={$current_blog->site_id}&amp;t=" .
mt_rand() . "&amp;back=" . urlencode( $protocol . $current_blog->domain .
$_SERVER[ 'REQUEST_URI' ] ) . "' type='text/javascript'></script>";
-}
-
-// delete mapping if blog is deleted
-function delete_blog_domain_mapping( $blog_id, $drop ) {
- global $wpdb;
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- if ( $blog_id && $drop ) {
- // Get an array of domain names to pass onto any
delete_blog_domain_mapping actions
- $domains = $wpdb->get_col( $wpdb->prepare( "SELECT domain FROM
{$wpdb->dmtable} WHERE blog_id = %d", $blog_id ) );
- do_action('dm_delete_blog_domain_mappings', $domains);
-
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->dmtable} WHERE
blog_id = %d", $blog_id ) );
- }
-}
-add_action( 'delete_blog', 'delete_blog_domain_mapping', 1, 2 );
-
-// show mapping on site admin blogs screen
-function ra_domain_mapping_columns( $columns ) {
- $columns[ 'map' ] = __( 'Mapping' );
- return $columns;
-}
-add_filter( 'wpmu_blogs_columns', 'ra_domain_mapping_columns' );
-
-function ra_domain_mapping_field( $column, $blog_id ) {
- global $wpdb;
- static $maps = false;
-
- if ( $column == 'map' ) {
- if ( $maps === false ) {
- $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
- $work = $wpdb->get_results( "SELECT blog_id, domain FROM
{$wpdb->dmtable} ORDER BY blog_id" );
- $maps = array();
- if($work) {
- foreach( $work as $blog ) {
- $maps[ $blog->blog_id ][] = $blog->domain;
- }
- }
- }
- if(is_array( $maps[ $blog_id ] ) && count( $maps[ $blog_id ] )) {
- foreach( $maps[ $blog_id ] as $blog ) {
- echo $blog . '<br />';
- }
- }
- }
-}
-add_action( 'manage_blogs_custom_column', 'ra_domain_mapping_field', 1, 3
);
-
-?>
=======================================
--- /plugins/wordpress-mu-domain-mapping/trunk/les_meg.txt Thu Jul 1
10:27:27 2010
+++ /dev/null
@@ -1,13 +0,0 @@
-Dette innstikket ble laget for WordPress MU, og er ikke ennå oppdatert.
-
-Det er i tillegg noen feil i domain_mapping.php.
-
-Jeg har derfor midlertidig lagt opp den versjonen jeg bruker her,
-håper at dette retter seg til i fremtidige versjoenr.
-
-Med denne versjonen, legges de oversatte filene i en mappen:
-wp-content/plugins/wordpress-mu-domain-mapping/
-selve innstikket legges (som det står i installasjonsveiledningen) i:
-wp-content/mu-plugins/
-og i tillegg legges altså "sunrise.php" i:
-wp-content/
=======================================
---
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.mo
Thu Jul 1 10:27:27 2010
+++
/plugins/wordpress-mu-domain-mapping/tags/0.5.3/languages/wordpress-mu-domain-mapping-nb_NO.mo
Mon Jan 17 01:40:46 2011
Binary file, no diff available.
=======================================
---
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.po
Thu Jul 1 10:27:27 2010
+++
/plugins/wordpress-mu-domain-mapping/tags/0.5.3/languages/wordpress-mu-domain-mapping-nb_NO.po
Mon Jan 17 01:40:46 2011
@@ -7,287 +7,300 @@
msgstr ""
"Project-Id-Version: WordPress MU Domain Mapping\n"
"Report-Msgid-Bugs-To:
http://wordpress.org/tag/wordpress-mu-domain-mapping\n"
-"POT-Creation-Date: 2010-06-22 20:39+0000\n"
-"PO-Revision-Date: 2010-07-01 18:19+0100\n"
+"POT-Creation-Date: 2010-10-29 11:55+0000\n"
+"PO-Revision-Date: 2011-01-17 10:35+0100\n"
"Last-Translator: Peter Holme <pe...@holme.se>\n"
"Language-Team: http://code.google.com/p/no-wp/\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: Norwegian Bokmal\n"
"X-Poedit-Country: NORWAY\n"

-#: domain_mapping.php:29
+#: domain_mapping.php:34
msgid "Domain Mapping Disabled."
msgstr "Domenehåndtering deaktivert."

-#: domain_mapping.php:29
+#: domain_mapping.php:34
#, php-format
msgid "You must <a href=\"%1$s\">create a network</a> for it to work."
msgstr "Du må <a href=\"%1$s\">lage et nettverk</a> for at dette skal
fungere."

-#: domain_mapping.php:40
+#: domain_mapping.php:45
msgid "The domain mapping plugin only works if the site is installed in /.
This is a limitation of how virtual servers work and is very difficult to
work around."
msgstr "Innstikket for domenehåndtering fungerer kun hvis nettstedet er
installert i /. Det er en begrensning på hvordan virtuelle servere fungerer
som er veldig vanskelig å jobbe seg forbi."

-#: domain_mapping.php:62
+#: domain_mapping.php:67
msgid "New domain added."
msgstr "Nye domener lagt til."

-#: domain_mapping.php:65
+#: domain_mapping.php:70
msgid "New domain already exists."
msgstr "Nytt domene finnes allerede."

-#: domain_mapping.php:68
+#: domain_mapping.php:73
msgid "New primary domain."
msgstr "Nytt primærdomene."

-#: domain_mapping.php:71
+#: domain_mapping.php:76
msgid "Domain deleted."
msgstr "Domene slettet."

-#: domain_mapping.php:109
+#: domain_mapping.php:114
msgid "Domain mapping database table created."
msgstr "Tabell for domenehåndtering ble laget i databasen."

-#: domain_mapping.php:124
-#: domain_mapping.php:236
+#: domain_mapping.php:129
+#: domain_mapping.php:252
#, php-format
msgid "<strong>Warning!</strong> This plugin will only work if WordPress
is installed in the root directory of your webserver. It is currently
installed in &#8217;%s&#8217;."
msgstr "<strong>Advarsel!</strong> Dette innstikket vil kun fungere hvis
WordPress er installert i root-mappen på nettstedet. Det er nå installert i
&#8217;%s&#8217;."

-#: domain_mapping.php:130
+#: domain_mapping.php:135
msgid "Domain Mapping: Domains"
msgstr "Domenehåndtering: domener"

-#: domain_mapping.php:139
+#: domain_mapping.php:144
msgid "Domain not found"
msgstr "Domene ikke funnet"

-#: domain_mapping.php:149
+#: domain_mapping.php:154
msgid "Domain Add"
msgstr "Domene lagt til"

-#: domain_mapping.php:152
+#: domain_mapping.php:157
msgid "Domain Updated"
msgstr "Domene oppdatert"

-#: domain_mapping.php:158
+#: domain_mapping.php:163
msgid "Domain Deleted"
msgstr "Domene slettet"

-#: domain_mapping.php:162
+#: domain_mapping.php:167
#, php-format
msgid "Searching for %s"
msgstr "Søker etter %s"

-#: domain_mapping.php:172
+#: domain_mapping.php:181
msgid "Search Domains"
msgstr "Søker i domener"

-#: domain_mapping.php:176
+#: domain_mapping.php:185
msgid "Domain:"
msgstr "Domene:"

-#: domain_mapping.php:178
+#: domain_mapping.php:187
msgid "Search"
msgstr "Søk"

-#: domain_mapping.php:187
+#: domain_mapping.php:196
msgid "Edit Domain"
msgstr "Rediger domene"

-#: domain_mapping.php:189
+#: domain_mapping.php:198
msgid "New Domain"
msgstr "Nytt domene"

-#: domain_mapping.php:199
-#: domain_mapping.php:212
+#: domain_mapping.php:208
+#: domain_mapping.php:225
msgid "Site ID"
msgstr "Nettsteds-ID"

-#: domain_mapping.php:200
-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:209
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Domain"
msgstr "Domene"

-#: domain_mapping.php:201
-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:210
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Primary"
msgstr "Primær"

-#: domain_mapping.php:205
+#: domain_mapping.php:214
+#: domain_mapping.php:238
+#: domain_mapping.php:459
+msgid "<strong>Warning!</strong> Primary domains are currently disabled."
+msgstr "<strong>Advarsel!</strong> Primærdomener er for tiden deaktivert."
+
+#: domain_mapping.php:217
msgid "Save"
msgstr "Lagre"

-#: domain_mapping.php:212
-#: domain_mapping.php:218
+#: domain_mapping.php:225
+#: domain_mapping.php:231
msgid "Edit"
msgstr "Rediger"

-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Delete"
msgstr "Slett"

-#: domain_mapping.php:215
+#: domain_mapping.php:228
msgid "Yes"
msgstr "Ja"

-#: domain_mapping.php:215
+#: domain_mapping.php:228
msgid "No"
msgstr "Nei"

-#: domain_mapping.php:220
+#: domain_mapping.php:233
msgid "Del"
msgstr "Slett"

-#: domain_mapping.php:261
+#: domain_mapping.php:282
msgid "Domain Mapping Configuration"
msgstr "Domenehåndtering: konfigurasjon"

-#: domain_mapping.php:264
+#: domain_mapping.php:285
msgid "As a super admin on this network you can set the IP address users
need to point their DNS A records at <em>or</em> the domain to point CNAME
record at. If you don't know what the IP address is, ping this blog to get
it."
msgstr "Som superadmin på dette nettverket kan du angi IP-adressen som
brukere må peke DNS A-oppføringene til <em>eller</em> domenen som
CNAME-oppføringer skal pekes til. Hvis du ikke vet hva IP-adressen er, ping
bloggen for å få den. "

-#: domain_mapping.php:265
+#: domain_mapping.php:286
msgid "If you use round robin DNS or another load balancing technique with
more than one IP, enter each address, separating them by commas."
msgstr "Hvis du bruker \"round robin DNS\" eller en annen
spredningsteknikk med mer enn én IP, skriv inn alle adressene, separert med
kommaer."

-#: domain_mapping.php:266
+#: domain_mapping.php:287
msgid "Server IP Address: "
msgstr "Servers IP-adresse: "

-#: domain_mapping.php:270
+#: domain_mapping.php:291
msgid "If you prefer the use of a CNAME record, you can set the domain
here. This domain must be configured with an A record or ANAME pointing at
an IP address. Visitors may experience problems if it is a CNAME of another
domain."
msgstr "Hvis du foretrekker å bruke en CNAME-oppføring, kan du bestemme
domenet her. Dette domenet må konfigureres med en A- eller ANAME-oppføring "

-#: domain_mapping.php:271
+#: domain_mapping.php:292
msgid "NOTE, this voids the use of any IP address set above"
msgstr "MERK, dette går foran bruk av IP-adressen som er bestemt ovenfor"

-#: domain_mapping.php:272
+#: domain_mapping.php:293
msgid "Server CNAME domain: "
msgstr "CNAME-domene for server: "

-#: domain_mapping.php:274
+#: domain_mapping.php:295
msgid "The information you enter here will be shown to your users so they
can configure their DNS correctly. It is for informational purposes only"
msgstr "Informasjonen du skriver inn her vil bli vist til dine brukere
slik at de kan konfigurere DNS-oppsettet på riktig måte. Det er kun for
informasjon"

-#: domain_mapping.php:276
+#: domain_mapping.php:297
msgid "Domain Options"
msgstr "Domeneinnstillinger"

-#: domain_mapping.php:279
+#: domain_mapping.php:300
msgid "Remote Login"
msgstr "Innlogging fra eksternt domene"

-#: domain_mapping.php:282
+#: domain_mapping.php:303
msgid "Permanent redirect (better for your blogger's pagerank)"
msgstr "Permanent omdirigering (bedre for nettstedenes søkerangering)"

-#: domain_mapping.php:285
+#: domain_mapping.php:306
msgid "User domain mapping page"
msgstr "Brukersider for domenehåndtering"

-#: domain_mapping.php:288
-msgid "Redirect administration pages to site's original domain (remote
login disabled if redirect disabled)"
+#: domain_mapping.php:309
+msgid "Redirect administration pages to site's original domain (remote
login disabled if this redirect is disabled)"
msgstr "Omdiriger adminsidene til nettstedets originale domene (hvis dette
ikke er aktivert, vil heller ikke \"Innlogging fra eksternt domene\" kunne
aktiveres)"

-#: domain_mapping.php:332
+#: domain_mapping.php:312
+msgid "Disable primary domain check. Sites will not redirect to one domain
name. May cause duplicate content issues."
+msgstr "Deaktiver sjekk for primærdomener. Brukere vil ikke automatisk
videresendes til ett domenenavn. Kan skape problemer med duplisert innhold."
+
+#: domain_mapping.php:357
msgid "You must enter a domain"
msgstr "Du må skrive inn et domene"

-#: domain_mapping.php:351
+#: domain_mapping.php:376
#, php-format
msgid "Please copy sunrise.php to %s/wp-content/sunrise.php and ensure the
SUNRISE definition is in %swp-config.php"
msgstr "Vennligst kopier sunrise.php til %s/wp-contet/sunrise.php og
forsikre deg om SUNRISE-definisjonen i %swp-config.php"

-#: domain_mapping.php:353
-#: domain_mapping.php:363
-#: domain_mapping.php:386
+#: domain_mapping.php:378
+#: domain_mapping.php:387
+#: domain_mapping.php:396
+#: domain_mapping.php:418
msgid "This plugin has not been configured correctly yet."
msgstr "Dette innstikket har ikke blitt korrekt konfigurert ennå."

-#: domain_mapping.php:361
+#: domain_mapping.php:385
#, php-format
msgid "Please uncomment the line <em>define( 'SUNRISE', 'on' );</em> or
add it to your %swp-config.php"
msgstr "Vennligst avkommenter linjen <em>define( 'SUNRISE', 'on');</em>
eller legg den til i din %swp-config.php"

-#: domain_mapping.php:380
+#: domain_mapping.php:394
+#, php-format
+msgid "Please edit your %swp-config.php and move the line
<em>define( 'SUNRISE', 'on' );</em> above the last require_once() in that
file or make sure you updated sunrise.php."
+msgstr "Vennligst rediger din %swp-config.php og flytt linjen
<em>define( 'SUNRISE', 'on' );</em> over den siste require_once() i den
filen eller forsikre deg om at du oppdaterte sunrise.php."
+
+#: domain_mapping.php:412
msgid "Domain Mapping"
msgstr "Domenehåndtering"

-#: domain_mapping.php:55
-msgid "Domains"
-msgstr "Domener"
-
-#: domain_mapping.php:384
+#: domain_mapping.php:416
msgid "Please set the IP address or CNAME of your server in the <a
href='wpmu-admin.php?page=dm_admin_page'>site admin page</a>."
msgstr "Vennligst angi IP-adressen eller CNAME til din server på <a
href='ms-admin.php?page=dm_admin_page'>konfigureringssiden</a>."

-#: domain_mapping.php:397
+#: domain_mapping.php:429
msgid "Active domains on this blog"
msgstr "Aktive domener på dette nettstedet"

-#: domain_mapping.php:421
+#: domain_mapping.php:454
msgid "Set Primary Domain"
msgstr "Angi primærdomene"

-#: domain_mapping.php:424
+#: domain_mapping.php:457
msgid "* The primary domain cannot be deleted."
msgstr "* Primærdomenet kan ikke slettes."

-#: domain_mapping.php:426
+#: domain_mapping.php:462
msgid "Add new domain"
msgstr "Legg til nytt domene"

-#: domain_mapping.php:431
+#: domain_mapping.php:467
msgid "Primary domain for this blog"
msgstr "Primært domene for dette nettstedet"

-#: domain_mapping.php:432
-msgid "Add"
-msgstr "Legg til"
-
-#: domain_mapping.php:437
+#: domain_mapping.php:473
#, php-format
msgid "If you want to redirect a domain you will need to add a DNS
\"CNAME\" record pointing to the following domain name for this server:
<strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene, må du legge til en DNS
\"CNAME\"-oppføring som peker til det følgende domenenavnet for denne
serveren: <strong>%s</strong>"

-#: domain_mapping.php:438
+#: domain_mapping.php:474
msgid "Google have published <a
href=\"http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317\"
target=\"_blank\">instructions</a> for creating CNAME records on various
hosting platforms such as GoDaddy and others."
msgstr "Google har publisert <a
href=\"http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317\"
target=\"_blank\">instruksjoner</a> for hvordan man lager CNAME-oppføringer
på ulike plattformer, som GoDaddy og andre."

-#: domain_mapping.php:440
+#: domain_mapping.php:476
msgid "If your domain name includes a hostname like \"www\", \"blog\" or
some other prefix before the actual domain name you will need to add a
CNAME for that hostname in your DNS pointing at this blog URL."
msgstr "Hvis ditt domenenavn inkluderer et vertsnavn som \"www\",
\"blogg\" eller et annet prefiks foran det reelle domenenavnet må du legge
til en CNAME-oppføring for det vertsnavnet i din DNS som peker til dette
nettstedets URL."

-#: domain_mapping.php:443
+#: domain_mapping.php:479
#, php-format
msgid "If you want to redirect a domain you will need to add DNS \"A\"
records pointing at the IP addresses of this server: <strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene må du legge til DNS
\"A\"-oppføringer som peker til IP-adressen til denne serveren:
<strong>%s</strong>"

-#: domain_mapping.php:445
+#: domain_mapping.php:481
#, php-format
msgid "If you want to redirect a domain you will need to add a DNS \"A\"
record pointing at the IP address of this server: <strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene må du legge til en DNS
\"A\"-oppføring som peker til IP-adressen til denne serveren:
<strong>%s</strong>"

-#: domain_mapping.php:662
+#: domain_mapping.php:712
msgid "Incorrect or out of date login key"
msgstr "Feil eller utdatert innloggingsnøkkel"

-#: domain_mapping.php:665
+#: domain_mapping.php:715
msgid "Unknown login key"
msgstr "Ukjent innloggingsnøkkel"

-#: domain_mapping.php:675
+#: domain_mapping.php:725
msgid "Unknown logout key"
msgstr "Ukjent utloggingsnøkkel"

-#: domain_mapping.php:706
+#: domain_mapping.php:758
msgid "Mapping"
msgstr "Håndtering"

+#~ msgid "Domains"
+#~ msgstr "Domener"
+
+#~ msgid "Add"
+#~ msgstr "Legg til"
=======================================
---
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.mo
Thu Jul 1 10:27:27 2010
+++
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.mo
Mon Jan 17 01:40:46 2011
Binary file, no diff available.
=======================================
---
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.po
Thu Jul 1 10:27:27 2010
+++
/plugins/wordpress-mu-domain-mapping/trunk/languages/wordpress-mu-domain-mapping-nb_NO.po
Mon Jan 17 01:40:46 2011
@@ -7,287 +7,300 @@
msgstr ""
"Project-Id-Version: WordPress MU Domain Mapping\n"
"Report-Msgid-Bugs-To:
http://wordpress.org/tag/wordpress-mu-domain-mapping\n"
-"POT-Creation-Date: 2010-06-22 20:39+0000\n"
-"PO-Revision-Date: 2010-07-01 18:19+0100\n"
+"POT-Creation-Date: 2010-10-29 11:55+0000\n"
+"PO-Revision-Date: 2011-01-17 10:35+0100\n"
"Last-Translator: Peter Holme <pe...@holme.se>\n"
"Language-Team: http://code.google.com/p/no-wp/\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: Norwegian Bokmal\n"
"X-Poedit-Country: NORWAY\n"

-#: domain_mapping.php:29
+#: domain_mapping.php:34
msgid "Domain Mapping Disabled."
msgstr "Domenehåndtering deaktivert."

-#: domain_mapping.php:29
+#: domain_mapping.php:34
#, php-format
msgid "You must <a href=\"%1$s\">create a network</a> for it to work."
msgstr "Du må <a href=\"%1$s\">lage et nettverk</a> for at dette skal
fungere."

-#: domain_mapping.php:40
+#: domain_mapping.php:45
msgid "The domain mapping plugin only works if the site is installed in /.
This is a limitation of how virtual servers work and is very difficult to
work around."
msgstr "Innstikket for domenehåndtering fungerer kun hvis nettstedet er
installert i /. Det er en begrensning på hvordan virtuelle servere fungerer
som er veldig vanskelig å jobbe seg forbi."

-#: domain_mapping.php:62
+#: domain_mapping.php:67
msgid "New domain added."
msgstr "Nye domener lagt til."

-#: domain_mapping.php:65
+#: domain_mapping.php:70
msgid "New domain already exists."
msgstr "Nytt domene finnes allerede."

-#: domain_mapping.php:68
+#: domain_mapping.php:73
msgid "New primary domain."
msgstr "Nytt primærdomene."

-#: domain_mapping.php:71
+#: domain_mapping.php:76
msgid "Domain deleted."
msgstr "Domene slettet."

-#: domain_mapping.php:109
+#: domain_mapping.php:114
msgid "Domain mapping database table created."
msgstr "Tabell for domenehåndtering ble laget i databasen."

-#: domain_mapping.php:124
-#: domain_mapping.php:236
+#: domain_mapping.php:129
+#: domain_mapping.php:252
#, php-format
msgid "<strong>Warning!</strong> This plugin will only work if WordPress
is installed in the root directory of your webserver. It is currently
installed in &#8217;%s&#8217;."
msgstr "<strong>Advarsel!</strong> Dette innstikket vil kun fungere hvis
WordPress er installert i root-mappen på nettstedet. Det er nå installert i
&#8217;%s&#8217;."

-#: domain_mapping.php:130
+#: domain_mapping.php:135
msgid "Domain Mapping: Domains"
msgstr "Domenehåndtering: domener"

-#: domain_mapping.php:139
+#: domain_mapping.php:144
msgid "Domain not found"
msgstr "Domene ikke funnet"

-#: domain_mapping.php:149
+#: domain_mapping.php:154
msgid "Domain Add"
msgstr "Domene lagt til"

-#: domain_mapping.php:152
+#: domain_mapping.php:157
msgid "Domain Updated"
msgstr "Domene oppdatert"

-#: domain_mapping.php:158
+#: domain_mapping.php:163
msgid "Domain Deleted"
msgstr "Domene slettet"

-#: domain_mapping.php:162
+#: domain_mapping.php:167
#, php-format
msgid "Searching for %s"
msgstr "Søker etter %s"

-#: domain_mapping.php:172
+#: domain_mapping.php:181
msgid "Search Domains"
msgstr "Søker i domener"

-#: domain_mapping.php:176
+#: domain_mapping.php:185
msgid "Domain:"
msgstr "Domene:"

-#: domain_mapping.php:178
+#: domain_mapping.php:187
msgid "Search"
msgstr "Søk"

-#: domain_mapping.php:187
+#: domain_mapping.php:196
msgid "Edit Domain"
msgstr "Rediger domene"

-#: domain_mapping.php:189
+#: domain_mapping.php:198
msgid "New Domain"
msgstr "Nytt domene"

-#: domain_mapping.php:199
-#: domain_mapping.php:212
+#: domain_mapping.php:208
+#: domain_mapping.php:225
msgid "Site ID"
msgstr "Nettsteds-ID"

-#: domain_mapping.php:200
-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:209
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Domain"
msgstr "Domene"

-#: domain_mapping.php:201
-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:210
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Primary"
msgstr "Primær"

-#: domain_mapping.php:205
+#: domain_mapping.php:214
+#: domain_mapping.php:238
+#: domain_mapping.php:459
+msgid "<strong>Warning!</strong> Primary domains are currently disabled."
+msgstr "<strong>Advarsel!</strong> Primærdomener er for tiden deaktivert."
+
+#: domain_mapping.php:217
msgid "Save"
msgstr "Lagre"

-#: domain_mapping.php:212
-#: domain_mapping.php:218
+#: domain_mapping.php:225
+#: domain_mapping.php:231
msgid "Edit"
msgstr "Rediger"

-#: domain_mapping.php:212
-#: domain_mapping.php:398
+#: domain_mapping.php:225
+#: domain_mapping.php:430
msgid "Delete"
msgstr "Slett"

-#: domain_mapping.php:215
+#: domain_mapping.php:228
msgid "Yes"
msgstr "Ja"

-#: domain_mapping.php:215
+#: domain_mapping.php:228
msgid "No"
msgstr "Nei"

-#: domain_mapping.php:220
+#: domain_mapping.php:233
msgid "Del"
msgstr "Slett"

-#: domain_mapping.php:261
+#: domain_mapping.php:282
msgid "Domain Mapping Configuration"
msgstr "Domenehåndtering: konfigurasjon"

-#: domain_mapping.php:264
+#: domain_mapping.php:285
msgid "As a super admin on this network you can set the IP address users
need to point their DNS A records at <em>or</em> the domain to point CNAME
record at. If you don't know what the IP address is, ping this blog to get
it."
msgstr "Som superadmin på dette nettverket kan du angi IP-adressen som
brukere må peke DNS A-oppføringene til <em>eller</em> domenen som
CNAME-oppføringer skal pekes til. Hvis du ikke vet hva IP-adressen er, ping
bloggen for å få den. "

-#: domain_mapping.php:265
+#: domain_mapping.php:286
msgid "If you use round robin DNS or another load balancing technique with
more than one IP, enter each address, separating them by commas."
msgstr "Hvis du bruker \"round robin DNS\" eller en annen
spredningsteknikk med mer enn én IP, skriv inn alle adressene, separert med
kommaer."

-#: domain_mapping.php:266
+#: domain_mapping.php:287
msgid "Server IP Address: "
msgstr "Servers IP-adresse: "

-#: domain_mapping.php:270
+#: domain_mapping.php:291
msgid "If you prefer the use of a CNAME record, you can set the domain
here. This domain must be configured with an A record or ANAME pointing at
an IP address. Visitors may experience problems if it is a CNAME of another
domain."
msgstr "Hvis du foretrekker å bruke en CNAME-oppføring, kan du bestemme
domenet her. Dette domenet må konfigureres med en A- eller ANAME-oppføring "

-#: domain_mapping.php:271
+#: domain_mapping.php:292
msgid "NOTE, this voids the use of any IP address set above"
msgstr "MERK, dette går foran bruk av IP-adressen som er bestemt ovenfor"

-#: domain_mapping.php:272
+#: domain_mapping.php:293
msgid "Server CNAME domain: "
msgstr "CNAME-domene for server: "

-#: domain_mapping.php:274
+#: domain_mapping.php:295
msgid "The information you enter here will be shown to your users so they
can configure their DNS correctly. It is for informational purposes only"
msgstr "Informasjonen du skriver inn her vil bli vist til dine brukere
slik at de kan konfigurere DNS-oppsettet på riktig måte. Det er kun for
informasjon"

-#: domain_mapping.php:276
+#: domain_mapping.php:297
msgid "Domain Options"
msgstr "Domeneinnstillinger"

-#: domain_mapping.php:279
+#: domain_mapping.php:300
msgid "Remote Login"
msgstr "Innlogging fra eksternt domene"

-#: domain_mapping.php:282
+#: domain_mapping.php:303
msgid "Permanent redirect (better for your blogger's pagerank)"
msgstr "Permanent omdirigering (bedre for nettstedenes søkerangering)"

-#: domain_mapping.php:285
+#: domain_mapping.php:306
msgid "User domain mapping page"
msgstr "Brukersider for domenehåndtering"

-#: domain_mapping.php:288
-msgid "Redirect administration pages to site's original domain (remote
login disabled if redirect disabled)"
+#: domain_mapping.php:309
+msgid "Redirect administration pages to site's original domain (remote
login disabled if this redirect is disabled)"
msgstr "Omdiriger adminsidene til nettstedets originale domene (hvis dette
ikke er aktivert, vil heller ikke \"Innlogging fra eksternt domene\" kunne
aktiveres)"

-#: domain_mapping.php:332
+#: domain_mapping.php:312
+msgid "Disable primary domain check. Sites will not redirect to one domain
name. May cause duplicate content issues."
+msgstr "Deaktiver sjekk for primærdomener. Brukere vil ikke automatisk
videresendes til ett domenenavn. Kan skape problemer med duplisert innhold."
+
+#: domain_mapping.php:357
msgid "You must enter a domain"
msgstr "Du må skrive inn et domene"

-#: domain_mapping.php:351
+#: domain_mapping.php:376
#, php-format
msgid "Please copy sunrise.php to %s/wp-content/sunrise.php and ensure the
SUNRISE definition is in %swp-config.php"
msgstr "Vennligst kopier sunrise.php til %s/wp-contet/sunrise.php og
forsikre deg om SUNRISE-definisjonen i %swp-config.php"

-#: domain_mapping.php:353
-#: domain_mapping.php:363
-#: domain_mapping.php:386
+#: domain_mapping.php:378
+#: domain_mapping.php:387
+#: domain_mapping.php:396
+#: domain_mapping.php:418
msgid "This plugin has not been configured correctly yet."
msgstr "Dette innstikket har ikke blitt korrekt konfigurert ennå."

-#: domain_mapping.php:361
+#: domain_mapping.php:385
#, php-format
msgid "Please uncomment the line <em>define( 'SUNRISE', 'on' );</em> or
add it to your %swp-config.php"
msgstr "Vennligst avkommenter linjen <em>define( 'SUNRISE', 'on');</em>
eller legg den til i din %swp-config.php"

-#: domain_mapping.php:380
+#: domain_mapping.php:394
+#, php-format
+msgid "Please edit your %swp-config.php and move the line
<em>define( 'SUNRISE', 'on' );</em> above the last require_once() in that
file or make sure you updated sunrise.php."
+msgstr "Vennligst rediger din %swp-config.php og flytt linjen
<em>define( 'SUNRISE', 'on' );</em> over den siste require_once() i den
filen eller forsikre deg om at du oppdaterte sunrise.php."
+
+#: domain_mapping.php:412
msgid "Domain Mapping"
msgstr "Domenehåndtering"

-#: domain_mapping.php:55
-msgid "Domains"
-msgstr "Domener"
-
-#: domain_mapping.php:384
+#: domain_mapping.php:416
msgid "Please set the IP address or CNAME of your server in the <a
href='wpmu-admin.php?page=dm_admin_page'>site admin page</a>."
msgstr "Vennligst angi IP-adressen eller CNAME til din server på <a
href='ms-admin.php?page=dm_admin_page'>konfigureringssiden</a>."

-#: domain_mapping.php:397
+#: domain_mapping.php:429
msgid "Active domains on this blog"
msgstr "Aktive domener på dette nettstedet"

-#: domain_mapping.php:421
+#: domain_mapping.php:454
msgid "Set Primary Domain"
msgstr "Angi primærdomene"

-#: domain_mapping.php:424
+#: domain_mapping.php:457
msgid "* The primary domain cannot be deleted."
msgstr "* Primærdomenet kan ikke slettes."

-#: domain_mapping.php:426
+#: domain_mapping.php:462
msgid "Add new domain"
msgstr "Legg til nytt domene"

-#: domain_mapping.php:431
+#: domain_mapping.php:467
msgid "Primary domain for this blog"
msgstr "Primært domene for dette nettstedet"

-#: domain_mapping.php:432
-msgid "Add"
-msgstr "Legg til"
-
-#: domain_mapping.php:437
+#: domain_mapping.php:473
#, php-format
msgid "If you want to redirect a domain you will need to add a DNS
\"CNAME\" record pointing to the following domain name for this server:
<strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene, må du legge til en DNS
\"CNAME\"-oppføring som peker til det følgende domenenavnet for denne
serveren: <strong>%s</strong>"

-#: domain_mapping.php:438
+#: domain_mapping.php:474
msgid "Google have published <a
href=\"http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317\"
target=\"_blank\">instructions</a> for creating CNAME records on various
hosting platforms such as GoDaddy and others."
msgstr "Google har publisert <a
href=\"http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=58317\"
target=\"_blank\">instruksjoner</a> for hvordan man lager CNAME-oppføringer
på ulike plattformer, som GoDaddy og andre."

-#: domain_mapping.php:440
+#: domain_mapping.php:476
msgid "If your domain name includes a hostname like \"www\", \"blog\" or
some other prefix before the actual domain name you will need to add a
CNAME for that hostname in your DNS pointing at this blog URL."
msgstr "Hvis ditt domenenavn inkluderer et vertsnavn som \"www\",
\"blogg\" eller et annet prefiks foran det reelle domenenavnet må du legge
til en CNAME-oppføring for det vertsnavnet i din DNS som peker til dette
nettstedets URL."

-#: domain_mapping.php:443
+#: domain_mapping.php:479
#, php-format
msgid "If you want to redirect a domain you will need to add DNS \"A\"
records pointing at the IP addresses of this server: <strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene må du legge til DNS
\"A\"-oppføringer som peker til IP-adressen til denne serveren:
<strong>%s</strong>"

-#: domain_mapping.php:445
+#: domain_mapping.php:481
#, php-format
msgid "If you want to redirect a domain you will need to add a DNS \"A\"
record pointing at the IP address of this server: <strong>%s</strong>"
msgstr "Hvis du vil omdirigere et domene må du legge til en DNS
\"A\"-oppføring som peker til IP-adressen til denne serveren:
<strong>%s</strong>"

-#: domain_mapping.php:662
+#: domain_mapping.php:712
msgid "Incorrect or out of date login key"
msgstr "Feil eller utdatert innloggingsnøkkel"

-#: domain_mapping.php:665
+#: domain_mapping.php:715
msgid "Unknown login key"
msgstr "Ukjent innloggingsnøkkel"

-#: domain_mapping.php:675
+#: domain_mapping.php:725
msgid "Unknown logout key"
msgstr "Ukjent utloggingsnøkkel"

-#: domain_mapping.php:706
+#: domain_mapping.php:758
msgid "Mapping"
msgstr "Håndtering"

+#~ msgid "Domains"
+#~ msgstr "Domener"
+
+#~ msgid "Add"
+#~ msgstr "Legg til"
Reply all
Reply to author
Forward
0 new messages