diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 734409fe1f..82d8abc27f 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -241,10 +241,11 @@ function wp_ajax_logged_in() { * @return die */ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { - $total = (int) @$_POST['_total']; - $per_page = (int) @$_POST['_per_page']; - $page = (int) @$_POST['_page']; - $url = esc_url_raw( @$_POST['_url'] ); + $total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0; + $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0; + $page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0; + $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; + // JS didn't send us everything we need to know. Just die with success message if ( !$total || !$per_page || !$page || !$url ) wp_die( time() ); diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index d64fe4bba4..9d7d6e8c19 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -192,8 +192,12 @@ class WP_Filesystem_Base { $folder = untrailingslashit($folder); + if ( $this->verbose ) + printf( "\n" . __('Looking for %1$s in %2$s') . "
\n", $folder, $base ); + $folder_parts = explode('/', $folder); - $last_index = array_pop( array_keys( $folder_parts ) ); + $folder_part_keys = array_keys( $folder_parts ); + $last_index = array_pop( $folder_part_keys ); $last_path = $folder_parts[ $last_index ]; $files = $this->dirlist( $base ); @@ -210,7 +214,7 @@ class WP_Filesystem_Base { //Lets try that folder: $newdir = trailingslashit(path_join($base, $key)); if ( $this->verbose ) - printf( __('Changing to %s') . '
', $newdir ); + printf( "\n" . __('Changing to %s') . "
\n", $newdir ); // only search for the remaining path tokens in the directory, not the full path again $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) @@ -221,13 +225,18 @@ class WP_Filesystem_Base { //Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take. if (isset( $files[ $last_path ] ) ) { if ( $this->verbose ) - printf( __('Found %s') . '
', $base . $last_path ); + printf( "\n" . __('Found %s') . "
\n", $base . $last_path ); return trailingslashit($base . $last_path); } - if ( $loop ) - return false; //Prevent this function from looping again. - //As an extra last resort, Change back to / if the folder wasn't found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups. - return $this->search_for_folder($folder, '/', true); + + // Prevent this function from looping again. + // No need to proceed if we've just searched in / + if ( $loop || '/' == $base ) + return false; + + // As an extra last resort, Change back to / if the folder wasn't found. + // This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... + return $this->search_for_folder( $folder, '/', true ); } diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 4b6417f861..c37dc0b1c4 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2077,17 +2077,18 @@ $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmon $arc_result = $wpdb->get_results( $arc_query ); $month_count = count($arc_result); +$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>