Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r3422 r4349  
    44$title = __('Posts');
    55$parent_file = 'edit.php';
    6 $list_js = true;
     6wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
    77require_once('admin-header.php');
    88
     
    5656<h2>
    5757<?php
    58 $what_to_show = 'posts';
    59 $posts_per_page = 15;
    60 $posts_per_archive_page = -1;
    61 
    62 wp();
     58
     59wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
    6360
    6461if ( is_month() ) {
     
    7774</h2>
    7875
    79 <form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;">
     76<form name="searchform" id="searchform" action="" method="get">
    8077  <fieldset>
    8178  <legend><?php _e('Search Posts&hellip;') ?></legend>
    8279  <input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" />
    83   <input type="submit" name="submit" value="<?php _e('Search') ?>" />
     80  <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />
    8481  </fieldset>
    8582</form>
    8683
    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");
     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");
    8885
    8986if ( count($arc_result) ) { ?>
    9087
    91 <form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
     88<form name="viewarc" id="viewarc" action="" method="get">
    9289    <fieldset>
    9390    <legend><?php _e('Browse Month&hellip;') ?></legend>
    9491    <select name='m'>
    9592    <?php
    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'] )
     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'] )
    10199                $default = 'selected="selected"';
    102100            else
    103101                $default = null;
    104            
    105             echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
    106             echo $month[zeroise($arc_month, 2)] . " $arc_year";
     102
     103            echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
     104            echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
    107105            echo "</option>\n";
    108106        }
    109107    ?>
    110108    </select>
    111         <input type="submit" name="submit" value="<?php _e('Show Month') ?>" />
     109        <input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
    112110    </fieldset>
    113111</form>
     
    115113<?php } ?>
    116114
     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
    117125<br style="clear:both;" />
    118126
    119127<?php
    120 
    121128// define the columns to display, the syntax is 'internal name' => 'display name'
    122129$posts_columns = array(
     
    137144?>
    138145
    139 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
     146<table class="widefat">
     147    <thead>
    140148    <tr>
    141149
     
    145153
    146154    </tr>
     155    </thead>
     156    <tbody id="the-list">
    147157<?php
    148158if ($posts) {
    149159$bgcolor = '';
    150160foreach ($posts as $post) { start_wp();
     161add_filter('the_title','wp_specialchars');
    151162$class = ('alternate' == $class) ? '' : 'alternate';
    152163?>
     
    158169
    159170    switch($column_name) {
    160    
     171
    161172    case 'id':
    162173        ?>
    163         <th scope="row"><?php echo $id ?></th>
     174        <th scope="row" style="text-align: center"><?php echo $id ?></th>
    164175        <?php
    165176        break;
     
    185196    case 'comments':
    186197        ?>
    187         <td><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
     198        <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
    188199      <?php comments_number(__('0'), __('1'), __('%')) ?>
    189200      </a></td>
     
    211222    case 'control_delete':
    212223        ?>
    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>
     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>
    214225        <?php
    215226        break;
     
    233244<?php
    234245} // end if ($posts)
    235 ?>
     246?>
     247    </tbody>
    236248</table>
    237249
     
    249261    if ($comments) {
    250262    ?>
    251 <h3><?php _e('Comments') ?></h3>
    252 <ol id="comments">
    253 <?php
     263<h3 id="comments"><?php _e('Comments') ?></h3>
     264<ol id="the-comment-list" class="commentlist">
     265<?php
     266$i = 0;
    254267foreach ($comments as $comment) {
    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 -->
     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
     284if ( 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
    290297<?php //end of the loop, don't delete
    291298        } // end foreach
Note: See TracChangeset for help on using the changeset viewer.