Changeset 972

Show
Ignore:
Timestamp:
05/21/07 18:37:58 (1 year ago)
Author:
donncha
Message:

WP Merge to rev 5499, this is a big one! Test it before you put it live!
Test only, not for production use yet

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-ajax.php

    r933 r972  
    150150                'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->cat_ID", $cat_full_name)) 
    151151        ) ); 
     152        $x->send(); 
     153        break; 
     154case 'add-comment' : 
     155        if ( !current_user_can( 'edit_post', $id ) ) 
     156                die('-1'); 
     157        $search = isset($_POST['s']) ? $_POST['s'] : false; 
     158        $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25; 
     159 
     160        list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); 
     161 
     162        if ( !$comments ) 
     163                die('1'); 
     164        $x = new WP_Ajax_Response(); 
     165        foreach ( (array) $comments as $comment ) { 
     166                get_comment( $comment ); 
     167                ob_start(); 
     168                        _wp_comment_list_item( $comment->comment_ID ); 
     169                        $comment_list_item = ob_get_contents(); 
     170                ob_end_clean(); 
     171                $x->add( array( 
     172                        'what' => 'comment', 
     173                        'id' => $comment->comment_ID, 
     174                        'data' => $comment_list_item 
     175                ) ); 
     176        } 
    152177        $x->send(); 
    153178        break; 
  • trunk/wp-admin/admin-db.php

    r970 r972  
    125125        else 
    126126                $links_private = 0; 
     127 
     128 
     129        // Let's check if we have this category already, if so just do an update 
     130        if ( !$update && $cat_ID = category_object_exists( $category_nicename ) ) 
     131                $update = true; 
    127132 
    128133        if (!$update) { 
     
    154159        clean_category_cache($cat_ID); 
    155160 
     161        if ($update) 
     162                do_action('edited_category', $cat_ID); 
     163        else 
     164                do_action('created_category', $cat_ID); 
     165         
    156166        return $cat_ID; 
    157167} 
     
    244254 
    245255        return $cat_ids; 
     256} 
     257 
     258function category_object_exists($cat_name) { 
     259        global $wpdb; 
     260        if (!$category_nicename = sanitize_title($cat_name)) 
     261                return 0; 
     262 
     263        return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); 
    246264} 
    247265 
     
    420438        $wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'"); 
    421439        return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); 
     440         
     441        do_action('deleted_link', $link_id); 
    422442} 
    423443 
  • trunk/wp-admin/admin-footer.php

    r793 r972  
    33<p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p> 
    44<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br /> 
    5 <?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?></p> 
     5<?php printf( __('Version %s'), get_bloginfo('version') ); ?></p> 
    66</div> 
    77<?php do_action('admin_footer', ''); ?> 
  • trunk/wp-admin/admin-functions.php

    r933 r972  
    491491                $user->user_email = wp_specialchars( trim( $_POST['email'] )); 
    492492        if ( isset( $_POST['url'] ) ) { 
    493                 $user->user_url = wp_specialchars( trim( $_POST['url'] )); 
     493                $user->user_url = clean_url( trim( $_POST['url'] )); 
    494494                $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; 
    495495        } 
     
    703703        } 
    704704 
     705        $result = apply_filters('get_nested_categories', $result); 
    705706        usort( $result, 'sort_cats' ); 
    706707 
     
    774775        if (!$categories ) 
    775776                $categories = get_categories( 'hide_empty=0' ); 
     777 
     778        $children = _get_category_hierarchy(); 
    776779 
    777780        if ( $categories ) { 
     
    784787                        if ( $category->category_parent == $parent) { 
    785788                                echo "\t" . _cat_row( $category, $level ); 
    786                                 cat_rows( $category->cat_ID, $level +1, $categories ); 
     789                                if ( isset($children[$category->cat_ID]) ) 
     790                                        cat_rows( $category->cat_ID, $level +1, $categories ); 
    787791                        } 
    788792                } 
     
    816820        $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; 
    817821 
    818         $category->category_count = number_format( $category->category_count ); 
    819         $category->link_count = number_format( $category->link_count ); 
     822        $category->category_count = number_format_i18n( $category->category_count ); 
     823        $category->link_count = number_format_i18n( $category->link_count ); 
    820824        $posts_count = ( $category->category_count > 0 ) ? "<a href='edit.php?cat=$category->cat_ID'>$category->category_count</a>" : $category->category_count; 
    821825        return "<tr id='cat-$category->cat_ID'$class> 
     
    897901        $r .= "</td>\n\t</tr>"; 
    898902        return $r; 
     903} 
     904 
     905function _wp_get_comment_list( $s = false, $start, $num ) { 
     906        global $wpdb; 
     907 
     908        $start = (int) $start; 
     909        $num = (int) $num; 
     910 
     911        if ( $s ) { 
     912                $s = $wpdb->escape($s); 
     913                $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE 
     914                        (comment_author LIKE '%$s%' OR 
     915                        comment_author_email LIKE '%$s%' OR 
     916                        comment_author_url LIKE ('%$s%') OR 
     917                        comment_author_IP LIKE ('%$s%') OR 
     918                        comment_content LIKE ('%$s%') ) AND 
     919                        comment_approved != 'spam' 
     920                        ORDER BY comment_date DESC LIMIT $start, $num"); 
     921        } else { 
     922                $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" ); 
     923        } 
     924 
     925        $total = $wpdb->get_var( "SELECT FOUND_ROWS()" ); 
     926 
     927        return array($comments, $total); 
     928} 
     929 
     930function _wp_comment_list_item( $id, $alt = 0 ) { 
     931        global $authordata, $comment, $wpdb; 
     932        $id = (int) $id; 
     933        $comment =& get_comment( $id ); 
     934        $class = ''; 
     935        $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 
     936        $comment_status = wp_get_comment_status($comment->comment_ID); 
     937        if ( 'unapproved' == $comment_status ) 
     938                $class .= ' unapproved'; 
     939        if ( $alt % 2 ) 
     940                $class .= ' alternate'; 
     941        echo "<li id='comment-$comment->comment_ID' class='$class'>"; 
     942?> 
     943<p><strong><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 
     944 
     945<?php comment_text() ?> 
     946 
     947<p><?php comment_date(__('M j, g:i A'));  ?> &#8212; [ 
     948<?php 
     949if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
     950        echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>'; 
     951        echo ' | <a href="' . wp_nonce_url('ocomment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 
     952        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 
     953                echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>'; 
     954                echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; 
     955        } 
     956        echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> "; 
     957} 
     958$post = get_post($comment->comment_post_ID); 
     959$post_title = wp_specialchars( $post->post_title, 'double' ); 
     960$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 
     961?> 
     962 ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p> 
     963                </li> 
     964<?php 
    899965} 
    900966 
     
    12801346function page_template_dropdown( $default = '' ) { 
    12811347        $templates = get_page_templates(); 
     1348        ksort( $templates ); 
    12821349        foreach (array_keys( $templates ) as $template ) 
    12831350                : if ( $default == $templates[$template] ) 
     
    16851752        } 
    16861753 
    1687         return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1] ); 
     1754        return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version); 
    16881755} 
    16891756 
     
    17021769        if ( $plugins_dir ) { 
    17031770                while (($file = $plugins_dir->read() ) !== false ) { 
    1704                         if ( preg_match( '|^\.+$|', $file )
     1771                        if ( substr($file, 0, 1) == '.'
    17051772                                continue; 
    17061773                        if ( is_dir( $plugin_root.'/'.$file ) ) { 
     
    17081775                                if ( $plugins_subdir ) { 
    17091776                                        while (($subfile = $plugins_subdir->read() ) !== false ) { 
    1710                                                 if ( preg_match( '|^\.+$|', $subfile )
     1777                                                if ( substr($subfile, 0, 1) == '.'
    17111778                                                        continue; 
    1712                                                 if ( preg_match( '|\.php$|', $subfile )
     1779                                                if ( substr($subfile, -4) == '.php'
    17131780                                                        $plugin_files[] = "$file/$subfile"; 
    17141781                                        } 
    17151782                                } 
    17161783                        } else { 
    1717                                 if ( preg_match( '|\.php$|', $file )
     1784                                if ( substr($file, -4) == '.php'
    17181785                                        $plugin_files[] = $file; 
    17191786                        } 
     
    17961863function get_importers() { 
    17971864        global $wp_importers; 
    1798  
     1865        uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); 
    17991866        return $wp_importers; 
    18001867} 
     
    18791946                extract( $wp_filetype ); 
    18801947 
    1881                 if ( !$type || !$ext
     1948                if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' )
    18821949                        return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); 
     1950                 
     1951                if ( !$ext ) 
     1952                        $ext = strrchr($file['name'], '.'); 
    18831953        } 
    18841954 
     
    19512021<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>"> 
    19522022<p> 
     2023<?php wp_nonce_field('import-upload'); ?> 
    19532024<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?> ) 
    19542025<input type="file" id="upload" name="import" size="25" /> 
  • trunk/wp-admin/admin-header.php

    r920 r972  
    1414?> 
    1515<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    16 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 
     16<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> 
    1717<head> 
    1818<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 
     
    4545<body> 
    4646<div id="wphead"> 
    47 <h1><?php echo wptexturize(get_bloginfo(('name'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1> 
     47<h1><?php bloginfo('name'); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1> 
    4848</div> 
    4949<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div> 
  • trunk/wp-admin/cat.js

    r909 r972  
    55        if ( !jaxcat ) 
    66                return false; 
    7         Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><span id="howto">' + catL10n.how + '</span></span>'); 
     7        Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>'); 
    88        $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 
    99        $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 
  • trunk/wp-admin/categories.js

    r753 r972  
    33        document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); }; 
    44        theList.addComplete = function(what, where, update, transport) { 
    5                 var name = getNodeValue(transport.responseXML, 'name')
     5                var name = getNodeValue(transport.responseXML, 'name').unescapeHTML()
    66                var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id'); 
    77                var options = document.forms['addcat'].category_parent.options; 
  • trunk/wp-admin/categories.php

    r920 r972  
    119119 
    120120<?php include('edit-category-form.php'); ?> 
     121 
    121122<?php endif; ?> 
    122123 
  • trunk/wp-admin/comment.php

    r821 r972  
    9292<tr> 
    9393<th scope="row"><?php _e('URL:'); ?></th> 
    94 <td><?php echo $comment->comment_author_url; ?></td> 
     94<td><?php echo "<a href='$comment->comment_author_url'>$comment->comment_author_url</a>"; ?></td> 
    9595</tr> 
    9696<?php } ?> 
  • trunk/wp-admin/custom-header.php

    • Property svn:eol-style set to native
    r909 r972  
    2424 
    2525                if ( isset( $_POST['textcolor'] ) ) { 
     26                        check_admin_referer('custom-header'); 
    2627                        if ( 'blank' == $_POST['textcolor'] ) { 
    2728                                set_theme_mod('header_textcolor', 'blank'); 
     
    3233                        } 
    3334                } 
    34                 if ( isset($_POST['resetheader']) ) 
     35                if ( isset($_POST['resetheader']) ) { 
     36                        check_admin_referer('custom-header'); 
    3537                        remove_theme_mods(); 
     38                } 
    3639        ?> 
    3740<script type="text/javascript"> 
     
    158161<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p> 
    159162 
    160 <div id="headimg" style="background: url(<?php header_image() ?>) no-repeat;"> 
     163<div id="headimg" style="background: url(<?php clean_url(header_image()) ?>) no-repeat;"> 
    161164<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1> 
    162165<div id="desc"><?php bloginfo('description');?></div> 
     
    166169<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" /> 
    167170<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" /> 
    168 <input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form> 
     171<?php wp_nonce_field('custom-header') ?> 
     172<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form> 
    169173<?php } ?> 
    170174 
     
    178182<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" /> 
    179183<input type="hidden" name="action" value="save" /> 
     184<?php wp_nonce_field('custom-header') ?> 
    180185<p class="submit"> 
    181186<input type="submit" value="<?php _e('Upload'); ?> &raquo;" /> 
     
    190195<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p> 
    191196<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>"> 
     197<?php wp_nonce_field('custom-header'); ?> 
    192198<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" /> 
    193199</form> 
     
    198204 
    199205        function step_2() { 
     206                check_admin_referer('custom-header'); 
    200207                $overrides = array('test_form' => false); 
    201208                $file = wp_handle_upload($_FILES['import'], $overrides); 
     
    223230 
    224231                if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) { 
    225                         set_theme_mod('header_image', $url); 
     232                        set_theme_mod('header_image', clean_url($url)); 
    226233                        $header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication 
    227234                        return $this->finished(); 
     
    257264<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" /> 
    258265<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" /> 
     266<?php wp_nonce_field('custom-header') ?> 
    259267<input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" /> 
    260268</p> 
     
    266274 
    267275        function step_3() { 
     276                check_admin_referer('custom-header'); 
    268277                if ( $_POST['oitar'] > 1 ) { 
    269278                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; 
  • trunk/wp-admin/dbx-admin-key.js

    r909 r972  
    1 addLoadEvent( function() {var manager = new dbxManager( dbxL10n.mananger );} ); 
     1addLoadEvent( function() {var manager = new dbxManager( dbxL10n.manager );} ); 
    22 
    33addLoadEvent( function() 
  • trunk/wp-admin/edit-comments.js

    r559 r972  
    33        if ( !theCommentList ) 
    44                return false; 
     5 
     6        theExtraCommentList = new listMan('the-extra-comment-list'); 
     7        if ( theExtraCommentList ) { 
     8                theExtraCommentList.showLink = 0; 
     9                theExtraCommentList.altOffset = 1; 
     10                if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes ) 
     11                        var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; 
     12                else 
     13                        var commentNum = 0; 
     14                var urlQ   = document.location.href.split('?'); 
     15                var params = urlQ[1] ? urlQ[1].toQueryParams() : []; 
     16                var search = params['s'] ? params['s'] : ''; 
     17                var page   = params['apage'] ? params['apage'] : 1; 
     18        } 
     19 
    520        theCommentList.dimComplete = function(what,id,dimClass) { 
    621                var m = document.getElementById('awaitmod'); 
    7                 if ( document.getElementById(what + '-' + id).className.match(dimClass) ) m.innerHTML = parseInt(m.innerHTML,10) + 1; 
    8                 else m.innerHTML = parseInt(m.innerHTML,10) - 1; 
     22                if ( document.getElementById(what + '-' + id).className.match(dimClass) ) 
     23                        m.innerHTML = parseInt(m.innerHTML,10) + 1; 
     24                else 
     25                        m.innerHTML = parseInt(m.innerHTML,10) - 1; 
    926        } 
     27 
    1028        theCommentList.delComplete = function(what,id) { 
    1129                var m = document.getElementById('awaitmod'); 
    12                 if ( document.getElementById(what + '-' + id).className.match('unapproved') ) m.innerHTML = parseInt(m.innerHTML,10) - 1; 
     30                what = what.split('-')[0]; 
     31                if ( document.getElementById(what + '-' + id).className.match('unapproved') ) 
     32                        m.innerHTML = parseInt(m.innerHTML,10) - 1; 
     33                if ( theExtraCommentList && commentNum ) { 
     34                        var theMover = theExtraCommentList.theList.childNodes[0]; 
     35                        Element.removeClassName(theMover,'alternate'); 
     36                        theCommentList.theList.appendChild(theMover); 
     37                        theExtraCommentList.inputData += '&page=' + page; 
     38                        if ( search ) 
     39                                theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box 
     40                        theExtraCommentList.addComplete = function() { 
     41                                if ( theExtraCommentList.theList.childNodes ) 
     42                                        var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; 
     43                                else 
     44                                        var commentNum = 0; 
     45                        } 
     46                        theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request 
     47                } 
    1348        } 
     49 
    1450        if ( theList ) // the post list: edit.php 
    1551                theList.delComplete = function() { 
  • trunk/wp-admin/edit-comments.php

    r933 r972  
    7676endif; 
    7777 
    78 if (isset($_GET['s'])) { 
    79         $s = $wpdb->escape($_GET['s']); 
    80         $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments  WHERE 
    81                 (comment_author LIKE '%$s%' OR 
    82                 comment_author_email LIKE '%$s%' OR 
    83                 comment_author_url LIKE ('%$s%') OR 
    84                 comment_author_IP LIKE ('%$s%') OR 
    85                 comment_content LIKE ('%$s%') ) AND 
    86                 comment_approved != 'spam' 
    87                 ORDER BY comment_date DESC"); 
    88 } else { 
    89         if ( isset( $_GET['apage'] ) ) 
    90                 $page = (int) $_GET['apage']; 
    91         else 
    92                 $page = 1; 
    93         $start = $offset = ( $page - 1 ) * 20; 
    94  
    95         $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, 20" ); 
    96         $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1'" ); 
    97 
    98 ?> 
    99 <?php if ( $total > 20 ) { 
    100 $total_pages = ceil( $total / 20 ); 
    101 $r = ''; 
    102 if ( 1 < $page ) { 
    103         $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; 
    104         $r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
    105 
    106 if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { 
    107         for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 
    108                 if ( $page == $page_num ) : 
    109                         $r .=  "<span>$page_num</span>\n"; 
    110                 else : 
    111                         $p = false; 
    112                         if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : 
    113                                 $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; 
    114                                 $r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; 
    115                                 $in = true; 
    116                         elseif ( $in == true ) : 
    117                                 $r .= "...\n"; 
    118                                 $in = false; 
    119                         endif; 
    120                 endif; 
    121         endfor; 
    122 
    123 if ( ( $page ) * 20 <