diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-09-11 15:20:17 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-09-11 15:20:17 +0000 |
commit | 93b61271ad288c6031c6b33405711e89a1575be2 (patch) | |
tree | 696aaab4050fc517f0a68bf680eeb6d1db10852b /wp-admin/admin-functions.php | |
parent | e30516b2ee40c1c45c8f288c20a3d4372e478624 (diff) | |
download | wordpress-mu-93b61271ad288c6031c6b33405711e89a1575be2.tar.gz wordpress-mu-93b61271ad288c6031c6b33405711e89a1575be2.tar.xz wordpress-mu-93b61271ad288c6031c6b33405711e89a1575be2.zip |
Use update_option_* actions
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@735 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/admin-functions.php')
-rw-r--r-- | wp-admin/admin-functions.php | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index d96d9e8..329f1f6 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -952,6 +952,7 @@ function wp_create_thumbnail($file, $max_side, $effect = '') { if (!empty ($error)) { return $error; } else { + apply_filters( 'wp_create_thumbnail', $thumbpath ); return $thumbpath; } } @@ -1924,8 +1925,8 @@ function wp_handle_upload(&$file, $overrides = false) { return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.')); } - // A writable uploads dir will pass this test. Again, there's no point overriding this one. - if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) + // A writable uploads dir will pass this test. Override with $uploads = array('path'=>$path, 'url'=>$url); + if ( ( empty( $uploads['path'] ) || empty( $uploads['url'] ) ) && ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) return $upload_error_handler($file, $uploads['error']); // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. @@ -2079,6 +2080,17 @@ function wp_reset_vars($vars) { } } +// If siteurl or home changed, reset cookies and flush rewrite rules. +function update_home_siteurl($old_value, $value) { + global $wp_rewrite, $user_login, $user_pass_md5; + // If home changed, write rewrite rules to new location. + $wp_rewrite->flush_rules(); + // Clear cookies for old paths. + wp_clearcookie(); + // Set cookies for new paths. + wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl')); +} + function autocomplete_css() { ?> <style type='text/css'> @@ -2108,9 +2120,9 @@ function autocomplete_css() { <?php } function autocomplete_textbox( $url, $search_field, $results_field ) { + wp_print_scripts('scriptaculous-controls'); ?> -<script type="text/javascript" src="<?php echo get_option( "siteurl" ) ?>/wp-includes/js/scriptaculous/prototype.js"></script> -<script type="text/javascript" src="<?php echo get_option( "siteurl" ) ?>/wp-includes/js/scriptaculous/scriptaculous.js"></script> + <script type="text/javascript"> function load_autocompleter() { new Ajax.Autocompleter("<?php echo $search_field ?>", "<?php echo $results_field ?>", "<?php echo $url ?>", {paramName: "search", minChars: 3}); @@ -2120,4 +2132,44 @@ addLoadEvent( load_autocompleter ); <?php } +add_action('update_option_home', 'update_home_siteurl', 10, 2); +add_action('update_option_siteurl', 'update_home_siteurl', 10, 2); + +function update_blog_public($old_value, $value) { + global $wpdb; + $value = (int) $value; + do_action('update_blog_public'); + update_blog_status( $wpdb->blogid, 'public', $value ); +} + +add_action('update_option_blog_public', 'update_blog_public', 10, 2); + +function update_option_new_admin_email($old_value, $value) { + if ( $value == get_option( 'admin_email' ) || !is_email( $value ) ) + return; + + $hash = md5( $value.time().mt_rand() ); + $newadminemail = array( + "hash" => $hash, + "newemail" => $value + ); + // TODO: gettext + wp_mail( $value, "[ " . get_option( 'blogname' ) . " ] New Admin Email Address", "Dear User, + +You recently requested to have the administration email address on +your blog changed. +If this is correct, please click on the following link to change it: +" . get_option( "siteurl" ) . "/wp-admin/options.php?adminhash={$hash} + +You can safely ignore and delete this email if you do not want to +take this action. + +This email has been sent to '{$value}' + +Regards, +The Webmaster" ); +} + +add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2); + ?> |