diff options
Diffstat (limited to 'plugins/akismet')
-rw-r--r-- | plugins/akismet/.htaccess | 6 | ||||
-rw-r--r-- | plugins/akismet/admin.php | 27 | ||||
-rw-r--r-- | plugins/akismet/akismet.js | 12 | ||||
-rw-r--r-- | plugins/akismet/akismet.php | 39 | ||||
-rw-r--r-- | plugins/akismet/readme.txt | 13 |
5 files changed, 51 insertions, 46 deletions
diff --git a/plugins/akismet/.htaccess b/plugins/akismet/.htaccess new file mode 100644 index 00000000..18eed640 --- /dev/null +++ b/plugins/akismet/.htaccess @@ -0,0 +1,6 @@ +Order Deny,Allow +Deny from all + +<FilesMatch "^akismet\.(css|js)$"> + Allow from all +</FilesMatch>
\ No newline at end of file diff --git a/plugins/akismet/admin.php b/plugins/akismet/admin.php index aa30cde7..9d7673f5 100644 --- a/plugins/akismet/admin.php +++ b/plugins/akismet/admin.php @@ -23,7 +23,6 @@ function akismet_admin_init() { $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' ); else $hook = 'dashboard_page_akismet-stats-display'; - add_action('admin_head-'.$hook, 'akismet_stats_script'); add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal'); } add_action('admin_init', 'akismet_admin_init'); @@ -56,7 +55,7 @@ $akismet_nonce = 'akismet-update-key'; function akismet_plugin_action_links( $links, $file ) { if ( $file == plugin_basename( dirname(__FILE__).'/akismet.php' ) ) { - $links[] = '<a href="admin.php?page=akismet-key-config">'.__('Settings').'</a>'; + $links[] = '<a href="' . admin_url( 'admin.php?page=akismet-key-config' ) . '">'.__( 'Settings' ).'</a>'; } return $links; @@ -240,23 +239,6 @@ function akismet_conf() { <?php } -function akismet_stats_script() { - ?> -<script type="text/javascript"> -function resizeIframe() { - - document.getElementById('akismet-stats-frame').style.height = "2500px"; - -}; -function resizeIframeInit() { - document.getElementById('akismet-stats-frame').onload = resizeIframe; - window.onresize = resizeIframe; -} -addLoadEvent(resizeIframeInit); -</script><?php -} - - function akismet_stats_display() { global $akismet_api_host, $akismet_api_port, $wpcom_api_key; $blog = urlencode( get_bloginfo('url') ); @@ -269,7 +251,7 @@ function akismet_stats_display() { $url .= "?blog={$blog}&api_key=" . akismet_get_key(); ?> <div class="wrap"> - <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe> + <iframe src="<?php echo $url; ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe> </div> <?php } @@ -329,7 +311,7 @@ function akismet_admin_warnings() { function akismet_warning() { global $wpdb; akismet_fix_scheduled_recheck(); - $waiting = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); + $waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ); $next_check = wp_next_scheduled('akismet_schedule_cron_recheck'); if ( $waiting > 0 && $next_check > time() ) echo " @@ -741,7 +723,8 @@ function akismet_recheck_queue() { delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' ); } - wp_safe_redirect( $_SERVER['HTTP_REFERER'] ); + $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' ); + wp_safe_redirect( $redirect_to ); exit; } diff --git a/plugins/akismet/akismet.js b/plugins/akismet/akismet.js index 839fe6bc..8925c51f 100644 --- a/plugins/akismet/akismet.js +++ b/plugins/akismet/akismet.js @@ -74,6 +74,7 @@ jQuery(document).ready(function () { return false; }); jQuery('a[id^="author_comment_url"]').mouseover(function () { + var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://'; // Need to determine size of author column var thisParentWidth = jQuery(this).parent().width(); // It changes based on if there is a gravatar present @@ -83,12 +84,12 @@ jQuery(document).ready(function () { jQuery('.widefat td').css('overflow', 'visible'); jQuery(this).css('position', 'relative'); var thisHref = jQuery.URLEncode(jQuery(this).attr('href')); - jQuery(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image_'+thisId+'" style="margin: 0;" /></div>'); + jQuery(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="'+wpcomProtocol+'s0.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image_'+thisId+'" style="margin: 0;" /></div>'); setTimeout(function () { - jQuery('.mshot-image_'+thisId).attr('src', 'http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2'); + jQuery('.mshot-image_'+thisId).attr('src', wpcomProtocol+'s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2'); }, 6000); setTimeout(function () { - jQuery('.mshot-image_'+thisId).attr('src', 'http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3'); + jQuery('.mshot-image_'+thisId).attr('src', wpcomProtocol+'s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3'); }, 12000); } else { jQuery(this).find('.mShot').css('left', thisParentWidth).show(); @@ -106,7 +107,8 @@ jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a }); // Preload mshot images after everything else has loaded jQuery(window).load(function() { + var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://'; jQuery('a[id^="author_comment_url"]').each(function () { - jQuery.get('http://s.wordpress.com/mshots/v1/'+jQuery.URLEncode(jQuery(this).attr('href'))+'?w=450'); + jQuery.get(wpcomProtocol+'s0.wordpress.com/mshots/v1/'+jQuery.URLEncode(jQuery(this).attr('href'))+'?w=450'); }); -});
\ No newline at end of file +}); diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php index 48fa3c3a..4c3aef71 100644 --- a/plugins/akismet/akismet.php +++ b/plugins/akismet/akismet.php @@ -5,8 +5,8 @@ /* Plugin Name: Akismet Plugin URI: http://akismet.com/?return=true -Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/?return=true">Sign up for an Akismet API key</a>, and 3) Go to your <a href="admin.php?page=akismet-key-config">Akismet configuration</a> page, and save your API key. -Version: 2.5.6 +Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/?return=true">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key. +Version: 2.5.7 Author: Automattic Author URI: http://automattic.com/wordpress-plugins/ License: GPLv2 or later @@ -28,7 +28,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -define('AKISMET_VERSION', '2.5.6'); +// Make sure we don't expose any info if called directly +if ( !function_exists( 'add_action' ) ) { + echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; + exit; +} + +define('AKISMET_VERSION', '2.5.7'); define('AKISMET_PLUGIN_URL', plugin_dir_url( __FILE__ )); /** If you hardcode a WP.com API key here, all key config screens will be hidden */ @@ -38,12 +44,6 @@ else $wpcom_api_key = ''; include '/var/www/blogs.gentoo.org/secrets/wp-apikey.php'; -// Make sure we don't expose any info if called directly -if ( !function_exists( 'add_action' ) ) { - echo "Hi there! I'm just a plugin, not much I can do when called directly."; - exit; -} - if ( isset($wp_db_version) && $wp_db_version <= 9872 ) include_once dirname( __FILE__ ) . '/legacy.php'; @@ -111,7 +111,7 @@ function akismet_test_mode() { } // return a comma-separated list of role names for the given user -function akismet_get_user_roles($user_id ) { +function akismet_get_user_roles( $user_id ) { $roles = false; if ( !class_exists('WP_User') ) @@ -278,10 +278,13 @@ function akismet_auto_check_update_meta( $id, $comment ) { if ( !function_exists('add_comment_meta') ) return false; + if ( !isset( $akismet_last_comment['comment_author_email'] ) ) + $akismet_last_comment['comment_author_email'] = ''; + // wp_insert_comment() might be called in other contexts, so make sure this is the same comment // as was checked by akismet_auto_check_comment if ( is_object($comment) && !empty($akismet_last_comment) && is_array($akismet_last_comment) ) { - if ( intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID) + if ( isset($akismet_last_comment['comment_post_ID']) && intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID) && $akismet_last_comment['comment_author'] == $comment->comment_author && $akismet_last_comment['comment_author_email'] == $comment->comment_author_email ) { // normal result: true or false @@ -320,15 +323,15 @@ function akismet_auto_check_comment( $commentdata ) { $comment = $commentdata; $comment['user_ip'] = $_SERVER['REMOTE_ADDR']; - $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; - $comment['referrer'] = $_SERVER['HTTP_REFERER']; + $comment['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; + $comment['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; $comment['blog'] = get_option('home'); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option('blog_charset'); $comment['permalink'] = get_permalink($comment['comment_post_ID']); if ( !empty( $comment['user_ID'] ) ) { - $comment['user_role'] = akismet_get_user_roles($comment['user_ID']); + $comment['user_role'] = akismet_get_user_roles( $comment['user_ID'] ); } $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); @@ -371,6 +374,7 @@ function akismet_auto_check_comment( $commentdata ) { $commentdata['comment_as_submitted'] = $comment; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); + do_action( 'akismet_comment_check_response', $response ); akismet_update_alert( $response ); $commentdata['akismet_result'] = $response[1]; if ( 'true' == $response[1] ) { @@ -387,7 +391,8 @@ function akismet_auto_check_comment( $commentdata ) { // akismet_result_spam() won't be called so bump the counter here if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); - wp_safe_redirect( $_SERVER['HTTP_REFERER'] ); + $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : get_permalink( $post ); + wp_safe_redirect( $redirect_to ); die(); } } @@ -499,7 +504,7 @@ function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); - return $response[1]; + return ( is_array( $response ) && isset( $response[1] ) ) ? $response[1] : false; } function akismet_cron_recheck() { @@ -566,7 +571,7 @@ function akismet_cron_recheck() { delete_comment_meta( $comment_id, 'akismet_rechecking' ); } - $remaining = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); + $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ); if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); } diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt index 227fad95..4d61fe9d 100644 --- a/plugins/akismet/readme.txt +++ b/plugins/akismet/readme.txt @@ -2,8 +2,8 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, automattic Tags: akismet, comments, spam Requires at least: 3.0 -Tested up to: 3.4 -Stable tag: 2.5.6 +Tested up to: 3.5 +Stable tag: 2.5.7 License: GPLv2 or later Akismet checks your comments against the Akismet web service to see if they look like spam or not. @@ -31,6 +31,15 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co == Changelog == += 2.5.7 = +* FireFox Stats iframe preview bug +* Fix mshots preview when using https +* Add .htaccess to block direct access to files +* Prevent some PHP notices +* Fix Check For Spam return location when referrer is empty +* Fix Settings links for network admins +* Fix prepare() warnings in WP 3.5 + = 2.5.6 = * Prevent retry scheduling problems on sites where wp_cron is misbehaving * Preload mshot previews |