Blog privacy. fixes #2480

git-svn-id: http://svn.automattic.com/wordpress/trunk@3548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-18 07:40:43 +00:00
parent 70197e85f3
commit 941ec0ff97
8 changed files with 34 additions and 4 deletions

View File

@ -107,6 +107,10 @@ switch($step) {
<th><?php _e('Your e-mail:'); ?></th>
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
</tr>
<tr>
<th scope="row" valign="top"> <?php __('Privacy:'); ?></th>
<td><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('I would like my blog to appear in search engines like Google and Technorati.'); ?></label></td>
</tr>
</table>
<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
<h2 class="step">
@ -121,6 +125,7 @@ switch($step) {
// Fill in the data we gathered
$weblog_title = stripslashes($_POST['weblog_title']);
$admin_email = stripslashes($_POST['admin_email']);
$public = (int) $_POST['blog_public'];
// check e-mail address
if (empty($admin_email)) {
die (__("<strong>ERROR</strong>: please type your e-mail address"));
@ -144,6 +149,10 @@ populate_roles();
update_option('blogname', $weblog_title);
update_option('admin_email', $admin_email);
update_option('blog_public', $public);
// If not a public blog, don't ping.
if ( ! $public )
update_option('default_pingback_flag', 0);
// Now drop in some default links
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')");

View File

@ -22,6 +22,11 @@ include('./admin-header.php');
<?php _e('In a few words, explain what this weblog is about.') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Search Engines:') ?> </th>
<td><label><input type="checkbox" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> /> <?php _e('I would like my blog to appear in search engines like Google and Technorati.'); ?></label>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('WordPress address (URI):') ?></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></td>
</tr>
@ -101,7 +106,7 @@ endfor;
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role" />
<input type="hidden" name="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role,blog_public" />
</p>
</form>

View File

@ -33,7 +33,7 @@ function upgrade_all() {
if ( $wp_current_db_version < 3308 )
upgrade_160();
if ( $wp_current_db_version < 3531 )
if ( $wp_current_db_version < 3548 )
upgrade_210();
$wp_rewrite->flush_rules();

View File

@ -229,6 +229,8 @@ function populate_options() {
add_option('uploads_use_yearmonth_folders', 1);
add_option('upload_path', 'wp-content/uploads');
}
// 2.1
add_option('blog_public', 1);
// Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog');

View File

@ -81,8 +81,11 @@ add_filter('comment_text_rss', 'ent2ncr', 8);
add_filter('bloginfo_rss', 'ent2ncr', 8);
add_filter('the_author', 'ent2ncr', 8);
// Misc filters
add_filter('option_ping_sites', 'privacy_ping_filter');
// Actions
add_action('wp_head', 'rsd_link');
add_action('publish_future_post', 'wp_publish_post', 10, 1);
add_action('wp_head', 'noindex', 1);
?>

View File

@ -2381,4 +2381,10 @@ function wp_cron() {
}
}
function privacy_ping_filter( $sites ) {
if ( get_option('blog_public') )
return $sites;
else
return '';
}
?>

View File

@ -702,4 +702,9 @@ function rsd_link() {
echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
}
function noindex() {
// If the blog is not public, tell robots to go away.
if ( ! get_option('blog_public') )
echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
}
?>

View File

@ -3,6 +3,6 @@
// This just holds the version number, in a separate file so we can bump it without cluttering the SVN
$wp_version = '2.1-alpha1';
$wp_db_version = 3531;
$wp_db_version = 3548;
?>