2004-04-28 19:49:27 +00:00
< ? php
2004-10-19 03:03:06 +00:00
require_once ( 'admin.php' );
2004-04-24 04:47:27 +00:00
2006-11-18 07:31:29 +00:00
$title = __ ( 'Posts' );
$parent_file = 'edit.php' ;
2006-05-22 17:16:05 +00:00
wp_enqueue_script ( 1 == $_GET [ 'c' ] ? 'admin-comments' : 'listman' );
2003-12-11 00:22:36 +00:00
require_once ( 'admin-header.php' );
2003-10-26 20:34:24 +00:00
2004-12-12 20:41:19 +00:00
$_GET [ 'm' ] = ( int ) $_GET [ 'm' ];
2005-07-08 22:59:15 +00:00
$drafts = get_users_drafts ( $user_ID );
$other_drafts = get_others_drafts ( $user_ID );
2004-09-14 11:24:50 +00:00
if ( $drafts || $other_drafts ) {
?>
< div class = " wrap " >
< ? php if ( $drafts ) { ?>
2004-04-24 04:47:27 +00:00
< p >< strong >< ? php _e ( 'Your Drafts:' ) ?> </strong>
2004-02-13 15:36:28 +00:00
< ? php
2003-12-31 22:21:50 +00:00
$i = 0 ;
foreach ( $drafts as $draft ) {
if ( 0 != $i )
echo ', ' ;
$draft -> post_title = stripslashes ( $draft -> post_title );
if ( $draft -> post_title == '' )
2004-04-24 04:47:27 +00:00
$draft -> post_title = sprintf ( __ ( 'Post #%s' ), $draft -> ID );
echo " <a href='post.php?action=edit&post= $draft->ID ' title=' " . __ ( 'Edit this draft' ) . " '> $draft->post_title </a> " ;
2003-12-31 22:21:50 +00:00
++ $i ;
}
2004-02-13 15:36:28 +00:00
?>
.</ p >
2004-09-14 10:02:48 +00:00
< ? php } ?>
2004-09-14 11:24:50 +00:00
< ? php if ( $other_drafts ) { ?>
2004-09-14 10:02:48 +00:00
< p >< strong >< ? php _e ( 'Other’s Drafts:' ) ?> </strong>
< ? php
$i = 0 ;
foreach ( $other_drafts as $draft ) {
if ( 0 != $i )
echo ', ' ;
$draft -> post_title = stripslashes ( $draft -> post_title );
if ( $draft -> post_title == '' )
$draft -> post_title = sprintf ( __ ( 'Post #%s' ), $draft -> ID );
echo " <a href='post.php?action=edit&post= $draft->ID ' title=' " . __ ( 'Edit this draft' ) . " '> $draft->post_title </a> " ;
++ $i ;
}
?>
.</ p >
2004-09-14 11:24:50 +00:00
< ? php } ?>
</ div >
< ? php } ?>
< div class = " wrap " >
< h2 >
2004-04-28 08:57:11 +00:00
< ? php
2005-03-28 02:34:16 +00:00
2006-02-21 08:39:58 +00:00
wp ( 'what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1' );
2005-03-28 02:34:16 +00:00
if ( is_month () ) {
single_month_title ( ' ' );
} elseif ( is_search () ) {
2004-12-12 20:41:19 +00:00
printf ( __ ( 'Search for “%s”' ), wp_specialchars ( $_GET [ 's' ]) );
2004-09-14 11:24:50 +00:00
} else {
2005-12-13 19:19:56 +00:00
if ( is_single () )
printf ( __ ( 'Comments on %s' ), $post -> post_title );
elseif ( ! is_paged () || get_query_var ( 'paged' ) == 1 )
2005-03-28 02:34:16 +00:00
_e ( 'Last 15 Posts' );
else
_e ( 'Previous Posts' );
2004-04-28 08:57:11 +00:00
}
?>
2004-09-14 11:24:50 +00:00
</ h2 >
2004-04-28 08:57:11 +00:00
2006-09-27 00:51:17 +00:00
< form name = " searchform " id = " searchform " action = " " method = " get " >
2004-09-14 11:24:50 +00:00
< fieldset >
< legend >< ? php _e ( 'Search Posts…' ) ?> </legend>
2005-04-20 04:06:37 +00:00
< input type = " text " name = " s " value = " <?php if (isset( $s )) echo wp_specialchars( $s , 1); ?> " size = " 17 " />
2006-10-06 01:14:47 +00:00
< input type = " submit " name = " submit " value = " <?php _e('Search') ?> " class = " button " />
2004-09-14 11:24:50 +00:00
</ fieldset >
</ form >
2006-02-14 06:23:03 +00:00
< ? 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 " );
2005-11-23 07:57:58 +00:00
2005-11-10 23:36:50 +00:00
if ( count ( $arc_result ) ) { ?>
2006-09-27 00:51:17 +00:00
< form name = " viewarc " id = " viewarc " action = " " method = " get " >
2004-04-28 08:57:11 +00:00
< fieldset >
2004-09-14 11:24:50 +00:00
< legend >< ? php _e ( 'Browse Month…' ) ?> </legend>
2004-05-09 05:47:02 +00:00
< select name = 'm' >
2004-04-28 08:57:11 +00:00
< ? php
2006-02-12 07:53:23 +00:00
foreach ( $arc_result as $arc_row ) {
2006-04-19 08:51:01 +00:00
if ( $arc_row -> yyear == 0 )
continue ;
$arc_row -> mmonth = zeroise ( $arc_row -> mmonth , 2 );
2006-02-12 07:53:23 +00:00
2006-04-19 08:51:01 +00:00
if ( isset ( $_GET [ 'm' ]) && $arc_row -> yyear . $arc_row -> mmonth == ( int ) $_GET [ 'm' ] )
2004-05-09 05:47:02 +00:00
$default = 'selected="selected"' ;
2004-04-28 08:57:11 +00:00
else
$default = null ;
2006-02-12 07:53:23 +00:00
2006-04-19 08:51:01 +00:00
echo " <option $default value=' $arc_row->yyear $arc_row->mmonth '> " ;
echo $wp_locale -> get_month ( $arc_row -> mmonth ) . " $arc_row->yyear " ;
2004-04-28 08:57:11 +00:00
echo " </option> \n " ;
}
?>
2004-05-09 05:47:02 +00:00
</ select >
2006-10-06 01:14:47 +00:00
< input type = " submit " name = " submit " value = " <?php _e('Show Month') ?> " class = " button " />
2004-04-28 08:57:11 +00:00
</ fieldset >
</ form >
2005-11-10 23:36:50 +00:00
< ? php } ?>
2006-09-27 00:51:17 +00:00
< form name = " viewcat " id = " viewcat " action = " " method = " get " >
2006-08-30 17:17:09 +00:00
< fieldset >
< legend >< ? php _e ( 'Browse Category…' ) ?> </legend>
2006-10-04 07:54:38 +00:00
< ? php wp_dropdown_categories ( 'show_option_all=' . __ ( 'All' ) . '&hide_empty=1&hierarchical=1&show_count=1&selected=' . $cat ); ?>
2006-10-06 01:14:47 +00:00
< input type = " submit " name = " submit " value = " <?php _e('Show Category') ?> " class = " button " />
2006-08-30 17:17:09 +00:00
</ fieldset >
</ form >
2006-10-04 07:54:38 +00:00
< ? php do_action ( 'restrict_manage_posts' ); ?>
2004-04-28 19:49:27 +00:00
< br style = " clear:both; " />
2004-04-28 08:57:11 +00:00
2005-02-11 17:58:11 +00:00
< ? php
// define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array (
'id' => __ ( 'ID' ),
'date' => __ ( 'When' ),
'title' => __ ( 'Title' ),
'categories' => __ ( 'Categories' ),
'comments' => __ ( 'Comments' ),
'author' => __ ( 'Author' )
);
$posts_columns = apply_filters ( 'manage_posts_columns' , $posts_columns );
// you can not edit these at the moment
$posts_columns [ 'control_view' ] = '' ;
$posts_columns [ 'control_edit' ] = '' ;
$posts_columns [ 'control_delete' ] = '' ;
?>
2006-05-10 20:35:10 +00:00
< table class = " widefat " >
2006-03-29 01:51:55 +00:00
< thead >
2005-02-11 17:58:11 +00:00
< tr >
< ? php foreach ( $posts_columns as $column_display_name ) { ?>
< th scope = " col " >< ? php echo $column_display_name ; ?> </th>
< ? php } ?>
</ tr >
2006-03-29 01:51:55 +00:00
</ thead >
< tbody id = " the-list " >
2004-05-14 06:19:46 +00:00
< ? php
2003-10-26 20:34:24 +00:00
if ( $posts ) {
2004-05-09 05:47:02 +00:00
$bgcolor = '' ;
2006-11-14 01:24:27 +00:00
while ( have_posts ()) : the_post ();
2006-03-29 01:51:55 +00:00
add_filter ( 'the_title' , 'wp_specialchars' );
2004-07-06 18:14:42 +00:00
$class = ( 'alternate' == $class ) ? '' : 'alternate' ;
2004-02-13 15:36:28 +00:00
?>
2005-08-31 02:39:17 +00:00
< tr id = 'post-<?php echo $id; ?>' class = '<?php echo $class; ?>' >
2005-02-11 17:58:11 +00:00
< ? php
foreach ( $posts_columns as $column_name => $column_display_name ) {
switch ( $column_name ) {
2006-02-12 07:53:23 +00:00
2005-02-11 17:58:11 +00:00
case 'id' :
?>
2006-09-27 00:51:17 +00:00
< th scope = " row " style = " text-align: center " >< ? php echo $id ?> </th>
2005-02-11 17:58:11 +00:00
< ? php
break ;
case 'date' :
?>
2006-11-19 07:24:55 +00:00
< td >< ? php if ( '0000-00-00 00:00:00' == $post -> post_modified ) _e ( 'Unpublished' ); else the_time ( 'Y-m-d \<\b\r \/\> g:i:s a' ); ?> </td>
2005-02-11 17:58:11 +00:00
< ? php
break ;
case 'title' :
?>
< td >< ? php the_title () ?>
< ? php if ( 'private' == $post -> post_status ) _e ( ' - <strong>Private</strong>' ); ?> </td>
< ? php
break ;
case 'categories' :
?>
< td >< ? php the_category ( ',' ); ?> </td>
< ? php
break ;
case 'comments' :
?>
2006-05-10 20:35:10 +00:00
< td style = " text-align: center " >< a href = " edit.php?p=<?php echo $id ?>&c=1 " >
2004-07-28 07:18:59 +00:00
< ? php comments_number ( __ ( '0' ), __ ( '1' ), __ ( '%' )) ?>
2005-02-11 17:58:11 +00:00
</ a ></ td >
< ? php
break ;
case 'author' :
?>
< td >< ? php the_author () ?> </td>
< ? php
break ;
case 'control_view' :
?>
< td >< a href = " <?php the_permalink(); ?> " rel = " permalink " class = " edit " >< ? php _e ( 'View' ); ?> </a></td>
< ? php
break ;
case 'control_edit' :
?>
2005-07-13 22:26:26 +00:00
< td >< ? php if ( current_user_can ( 'edit_post' , $post -> ID ) ) { echo " <a href='post.php?action=edit&post= $id ' class='edit'> " . __ ( 'Edit' ) . " </a> " ; } ?> </td>
2005-02-11 17:58:11 +00:00
< ? php
break ;
case 'control_delete' :
?>
2006-05-26 23:08:05 +00:00
< td >< ? php if ( current_user_can ( 'delete_post' , $post -> ID ) ) { echo " <a href=' " . wp_nonce_url ( " post.php?action=delete&post= $id " , 'delete-post_' . $post -> ID ) . " ' class='delete' onclick= \" return deleteSomething( 'post', " . $id . " , ' " . sprintf ( __ ( " You are about to delete this post "%s". \\ n"OK" to delete, "Cancel" to stop. " ), js_escape ( get_the_title ()) ) . " ' ); \" > " . __ ( 'Delete' ) . " </a> " ; } ?> </td>
2005-02-11 17:58:11 +00:00
< ? php
break ;
default :
?>
< td >< ? php do_action ( 'manage_posts_custom_column' , $column_name , $id ); ?> </td>
< ? php
break ;
}
}
?>
</ tr >
2004-02-13 15:36:28 +00:00
< ? php
2006-11-14 01:24:27 +00:00
endwhile ;
2004-02-13 15:36:28 +00:00
} else {
2003-10-26 20:34:24 +00:00
?>
2004-02-13 15:36:28 +00:00
< tr style = 'background-color: <?php echo $bgcolor; ?>' >
2004-04-24 04:47:27 +00:00
< td colspan = " 8 " >< ? php _e ( 'No posts found.' ) ?> </td>
2004-02-13 15:36:28 +00:00
</ tr >
< ? php
} // end if ($posts)
2006-03-29 01:51:55 +00:00
?>
</ tbody >
2005-08-31 02:39:17 +00:00
</ table >
< div id = " ajax-response " ></ div >
2005-03-28 02:34:16 +00:00
< div class = " navigation " >
< div class = " alignleft " >< ? php next_posts_link ( __ ( '« Previous Entries' )) ?> </div>
< div class = " alignright " >< ? php previous_posts_link ( __ ( 'Next Entries »' )) ?> </div>
</ div >
2004-02-13 15:36:28 +00:00
< ? php
2004-05-09 05:47:02 +00:00
if ( 1 == count ( $posts ) ) {
2003-10-26 20:34:24 +00:00
2005-02-05 18:32:57 +00:00
$comments = $wpdb -> get_results ( " SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date " );
2004-02-13 15:36:28 +00:00
if ( $comments ) {
?>
2006-03-31 08:32:30 +00:00
< h3 id = " comments " >< ? php _e ( 'Comments' ) ?> </h3>
2006-06-06 04:14:04 +00:00
< ol id = " the-comment-list " class = " commentlist " >
2004-02-13 15:36:28 +00:00
< ? php
2006-03-29 01:51:55 +00:00
$i = 0 ;
2004-02-13 15:36:28 +00:00
foreach ( $comments as $comment ) {
2006-04-19 08:30:56 +00:00
++ $i ; $class = '' ;
$authordata = get_userdata ( $wpdb -> get_var ( " SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID " ));
$comment_status = wp_get_comment_status ( $comment -> comment_ID );
if ( 'unapproved' == $comment_status )
$class .= ' unapproved' ;
if ( $i % 2 )
$class .= ' alternate' ;
echo " <li id='comment- $comment->comment_ID ' class=' $class '> " ;
?>
< 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>
< ? php comment_text () ?>
< p >< ? php comment_date ( 'M j, g:i A' ); ?> — [
< ? php
if ( current_user_can ( 'edit_post' , $comment -> comment_post_ID ) ) {
2006-10-31 06:50:38 +00:00
echo " <a href='comment.php?action=editcomment&c= " . $comment -> comment_ID . " \ '> " . __ ( 'Edit' ) . '</a>' ;
2006-06-06 04:14:04 +00:00
echo ' | <a href="' . wp_nonce_url ( 'comment.php?action=deletecomment&p=' . $post -> ID . '&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 "%s". \\ n"Cancel" to stop, "OK" to delete. " ), js_escape ( $comment -> comment_author )) . " ', theCommentList ); \" > " . __ ( 'Delete' ) . '</a> ' ;
2006-04-19 08:30:56 +00:00
if ( ( 'none' != $comment_status ) && ( current_user_can ( 'moderate_comments' ) ) ) {
2006-06-06 04:14:04 +00:00
echo '<span class="unapprove"> | <a href="' . wp_nonce_url ( 'comment.php?action=unapprovecomment&p=' . $post -> ID . '&comment=' . $comment -> comment_ID , 'unapprove-comment_' . $comment -> comment_ID ) . '" onclick="return dimSomething( \'comment\', ' . $comment -> comment_ID . ', \'unapproved\', theCommentList );">' . __ ( 'Unapprove' ) . '</a> </span>' ;
echo '<span class="approve"> | <a href="' . wp_nonce_url ( 'comment.php?action=approvecomment&p=' . $post -> ID . '&comment=' . $comment -> comment_ID , 'approve-comment_' . $comment -> comment_ID ) . '" onclick="return dimSomething( \'comment\', ' . $comment -> comment_ID . ', \'unapproved\', theCommentList );">' . __ ( 'Approve' ) . '</a> </span>' ;
2006-04-19 08:30:56 +00:00
}
2006-10-30 19:27:24 +00:00
echo " | <a href= \" " . wp_nonce_url ( " comment.php?action=deletecomment&dt=spam&p= " . $comment -> comment_post_ID . " &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 "%s". \\ n"Cancel" to stop, "OK" to mark as spam. " ), js_escape ( $comment -> comment_author )) . " ', theCommentList ); \" > " . __ ( 'Spam' ) . " </a> ] " ;
2006-04-19 08:30:56 +00:00
} // end if any comments to show
?>
</ p >
</ li >
2004-02-13 15:36:28 +00:00
< ? php //end of the loop, don't delete
} // end foreach
echo '</ol>' ;
} //end if comments
2003-10-26 20:34:24 +00:00
?>
2004-02-13 15:36:28 +00:00
< ? php } ?>
</ div >
2003-10-26 20:34:24 +00:00
< ? php
2003-12-11 00:22:36 +00:00
include ( 'admin-footer.php' );
2004-02-13 15:36:28 +00:00
?>