WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r4349 r3422  
    44$title = __('Posts');
    55$parent_file = 'edit.php';
    6 wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
     6$list_js = true;
    77require_once('admin-header.php');
    88
     
    5656<h2>
    5757<?php
    58 
    59 wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
     58$what_to_show = 'posts';
     59$posts_per_page = 15;
     60$posts_per_archive_page = -1;
     61
     62wp();
    6063
    6164if ( is_month() ) {
     
    7477</h2>
    7578
    76 <form name="searchform" id="searchform" action="" method="get">
     79<form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;">
    7780  <fieldset>
    7881  <legend><?php _e('Search Posts&hellip;') ?></legend>
    7982  <input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" />
    80   <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />
     83  <input type="submit" name="submit" value="<?php _e('Search') ?>" />
    8184  </fieldset>
    8285</form>
    8386
    84 <?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
     87<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
    8588
    8689if ( count($arc_result) ) { ?>
    8790
    88 <form name="viewarc" id="viewarc" action="" method="get">
     91<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
    8992    <fieldset>
    9093    <legend><?php _e('Browse Month&hellip;') ?></legend>
    9194    <select name='m'>
    9295    <?php
    93         foreach ($arc_result as $arc_row) {
    94             if ( $arc_row->yyear == 0 )
    95                 continue;
    96             $arc_row->mmonth = zeroise($arc_row->mmonth, 2);
    97 
    98             if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] )
     96        foreach ($arc_result as $arc_row) {         
     97            $arc_year  = $arc_row->yyear;
     98            $arc_month = $arc_row->mmonth;
     99           
     100            if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
    99101                $default = 'selected="selected"';
    100102            else
    101103                $default = null;
    102 
    103             echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
    104             echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
     104           
     105            echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
     106            echo $month[zeroise($arc_month, 2)] . " $arc_year";
    105107            echo "</option>\n";
    106108        }
    107109    ?>
    108110    </select>
    109         <input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
     111        <input type="submit" name="submit" value="<?php _e('Show Month') ?>" />
    110112    </fieldset>
    111113</form>
     
    113115<?php } ?>
    114116
    115 <form name="viewcat" id="viewcat" action="" method="get">
    116     <fieldset>
    117     <legend><?php _e('Browse Category&hellip;') ?></legend>
    118     <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
    119     <input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" />
    120     </fieldset>
    121 </form>
    122 
    123 <?php do_action('restrict_manage_posts'); ?>
    124 
    125117<br style="clear:both;" />
    126118
    127119<?php
     120
    128121// define the columns to display, the syntax is 'internal name' => 'display name'
    129122$posts_columns = array(
     
    144137?>
    145138
    146 <table class="widefat">
    147     <thead>
     139<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
    148140    <tr>
    149141
     
    153145
    154146    </tr>
    155     </thead>
    156     <tbody id="the-list">
    157147<?php
    158148if ($posts) {
    159149$bgcolor = '';
    160150foreach ($posts as $post) { start_wp();
    161 add_filter('the_title','wp_specialchars');
    162151$class = ('alternate' == $class) ? '' : 'alternate';
    163152?>
     
    169158
    170159    switch($column_name) {
    171 
     160   
    172161    case 'id':
    173162        ?>
    174         <th scope="row" style="text-align: center"><?php echo $id ?></th>
     163        <th scope="row"><?php echo $id ?></th>
    175164        <?php
    176165        break;
     
    196185    case 'comments':
    197186        ?>
    198         <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
     187        <td><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
    199188      <?php comments_number(__('0'), __('1'), __('%')) ?>
    200189      </a></td>
     
    222211    case 'control_delete':
    223212        ?>
    224         <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     213        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    225214        <?php
    226215        break;
     
    244233<?php
    245234} // end if ($posts)
    246 ?>
    247     </tbody>
     235?>
    248236</table>
    249237
     
    261249    if ($comments) {
    262250    ?>
    263 <h3 id="comments"><?php _e('Comments') ?></h3>
    264 <ol id="the-comment-list" class="commentlist">
    265 <?php
    266 $i = 0;
     251<h3><?php _e('Comments') ?></h3>
     252<ol id="comments">
     253<?php
    267254foreach ($comments as $comment) {
    268 
    269         ++$i; $class = '';
    270         $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    271             $comment_status = wp_get_comment_status($comment->comment_ID);
    272             if ('unapproved' == $comment_status)
    273                 $class .= ' unapproved';
    274             if ($i % 2)
    275                 $class .= ' alternate';
    276             echo "<li id='comment-$comment->comment_ID' class='$class'>";
    277 ?>
    278 <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>
    279 
    280 <?php comment_text() ?>
    281 
    282 <p><?php comment_date('M j, g:i A');  ?> &#8212; [
    283 <?php
    284 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    285     echo " <a href='comment.php?action=editcomment&amp;comment=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
    286     echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    287     if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    288         echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
    289         echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    290     }
    291     echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;delete_type=spam&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ]";
    292 } // end if any comments to show
    293 ?>
    294 </p>
    295         </li>
    296 
     255$comment_status = wp_get_comment_status($comment->comment_ID);
     256?>
     257
     258<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
     259  <?php comment_date('Y-n-j') ?>
     260  @
     261  <?php comment_time('g:m:s a') ?>
     262  <?php
     263            if ( current_user_can('edit_post', $post->ID) ) {
     264                echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" .  __('Edit') . "</a>";
     265                echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
     266                if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
     267                    if ('approved' == wp_get_comment_status($comment->comment_ID)) {
     268                        echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
     269                    } else {
     270                        echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
     271                    }
     272                }
     273                echo "]";
     274            } // end if any comments to show
     275            ?>
     276  <br />
     277  <strong>
     278  <?php comment_author() ?>
     279  (
     280  <?php comment_author_email_link() ?>
     281  /
     282  <?php comment_author_url_link() ?>
     283  )</strong> (IP:
     284  <?php comment_author_IP() ?>
     285  )
     286  <?php comment_text() ?>
     287
     288</li>
     289<!-- /comment -->
    297290<?php //end of the loop, don't delete
    298291        } // end foreach
Note: See TracChangeset for help on using the changeset viewer.